5. If the complex number $z$ satisfies $|z|=1, A(-1,0)$, and $B(0,-1)$ are two points on the complex plane, then the function $f(z) = |(z+1)(\bar{z}-\mathrm{i})|$ reaches its maximum value when the figure formed by points $Z, A, B$ on the complex plane is ( ).
(A) Equilateral triangle
(B) Isosceles triangle
(C) Right triangle
(D) Isosceles right triangle
5. (B).

Let $z=\cos \theta+\mathrm{i} \sin \theta$, then
$$
\begin{aligned}
& (z+1)(\vec{z}-\mathrm{i}) \\
= & (1+\cos \theta+\mathrm{i} \sin \theta)[\cos \theta-(1+\sin \theta) \mathrm{i}] \\
= & \cos \theta(1+\cos \theta)+\sin \theta(1+\sin \theta) \\
& +\mathrm{i}[\sin \theta \cdot \cos \theta-(1+\cos \theta)(1+\sin \theta)] \\
= & (\sin \theta+\cos \theta+1)-\mathrm{i}(1+\sin \theta+\cos \theta) .
\end{aligned}
$$

Therefore,
$$
\begin{aligned}
f(z) & =\sqrt{(1+\sin \theta+\cos \theta)^{2}+(\sin \theta+\cos \theta+1)^{2}} \\
& =\sqrt{2\left[1+\sqrt{2} \sin \left(\theta+\frac{\pi}{4}\right)\right]^{2}} .
\end{aligned}
$$

When $\theta=2 k \pi+\frac{\pi}{4}$
$(k \in \mathbf{Z})$, $f(z)$ is maximized, with the maximum value being $2+\sqrt{2}$. At this time,
$$
z=\cos \frac{\pi}{4}+\mathrm{i} \sin \frac{\pi}{4} \text {. }
$$

The positions of points $A, B, Z$ are as shown in Figure 2, clearly, $\triangle A B Z$ is an isosceles triangle, but it is neither equilateral nor right-angled.