Example 11 Let real numbers $x, y, z$ satisfy
$$
\left\{\begin{array}{l}
x+y=z-1, \\
x y=z^{2}-7 z+14 .
\end{array}\right.
$$

Question: What is the maximum value of $x^{2}+y^{2}$? For what value of $z$ does $x^{2}+y^{2}$ achieve its maximum value?
Solve: From $x+y=z-1$, we can set
$$
x=\frac{z-1}{2}+t, y=\frac{z-1}{2}-t \text {. }
$$

Substituting into $x y=z^{2}-7 z+14$ and simplifying, we get
$$
3 z^{2}-26 z-55=-4 t^{2} \text {. }
$$

Therefore, $3 z^{2}-26 z-55 \leqslant 0$.
Solving this, we get $\frac{11}{3} \leqslant z \leqslant 5$.
$$
\begin{array}{l}
\text { From } x^{2}+y^{2}=(x+y)^{2}-2 x y \\
=(z-1)^{2}-2\left(z^{2}-7 z+14\right) \\
=-(z-6)^{2}+9,
\end{array}
$$

Thus, when $z=5$, the maximum value of $x^{2}+y^{2}$ is 8.