Example 5 Given that $\frac{z-1}{z+1}$ is a pure imaginary number, find $\min \left|z^{2}-z+2\right|$.
Let $\frac{z-1}{z+1}=t i, t \in \mathbf{R}, t \neq 0$. Then we have
$$
z=\frac{1+t i}{1-t i} \Rightarrow|z|=1 \quad(z \neq \pm 1) .
$$

Let $z=\cos \theta+\mathrm{isin} \theta$, then we have
$$
\begin{aligned}
\left|z^{2}-z+2\right| & =|z(z-1+2 \bar{z})| \\
& =|z+2 \bar{z}-1| \\
& =|3 \cos \theta-1-i \sin \theta| \\
= & \sqrt{8\left(\cos \theta-\frac{3}{8}\right)^{2}+\frac{7}{8}} .
\end{aligned}
$$

Therefore, when $\cos \theta=\frac{3}{8}$, $\min \left|z^{2}-z+2\right|=\frac{\sqrt{14}}{4}$.
The technique of first finding $|z|=1$ and then separating it out in this problem is worth noting.