5. If the complex number $z$ satisfies
$$
\left|\frac{z^{2}+1}{z+\mathrm{i}}\right|+\left|\frac{z^{2}+4 \mathrm{i}-3}{z-\mathrm{i}+2}\right|=4 \text {, }
$$

then the minimum value of $\mid z-1$ | is
5. $\sqrt{2}$.
Notice that,
$$
\begin{array}{l}
\left|\frac{z^{2}+1}{z+\mathrm{i}}\right|+\left|\frac{z^{2}+4 \mathrm{i}-3}{z-\mathrm{i}+2}\right| \\
=|z-\mathrm{i}|+|z-(2-\mathrm{i})|=4>2 \sqrt{2} .
\end{array}
$$

Then the locus of $z$ is an ellipse with foci at $(0,1)$ and $(2,-1)$, where the center of the ellipse is at $(1,0)$, the length of the major axis is 4, and the focal distance is $2 \sqrt{2}$.

Also, $|z-1|$ represents the distance from a point on the ellipse to the center, so $|z-1|_{\min }=b=\sqrt{2}$.