Example 6 Given that $x, y, z$ are real numbers, and $x+y+z=5, xy+yz+zx=3$. Try to find the maximum and minimum values of $z$.
(Canadian 10th High School Mathematics Competition)
Solution: From the conditions, we have
$$
\begin{array}{l}
x+y=5-z, \\
x y=3-(x+y) z=3-(5-z) z \\
=z^{2}-5 z+3.
\end{array}
$$

And $(x+y)^{2}-4 x y=(x-y)^{2} \geqslant 0$,
Substituting $5-z$ and $z^{2}-5 z+3$ for $x+y$ and $x y$ respectively in the above equation, we get
$$
(5-z)^{2}-4\left(z^{2}-5 z+3\right) \geqslant 0,
$$

which simplifies to $3 z^{2}-10 z-13 \leqslant 0$.
Solving this, we get $-1 \leqslant z \leqslant \frac{13}{3}$.
Therefore, the maximum value of $z$ is $\frac{13}{3}$, and the minimum value is -1.