Example 8 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$. (10th Canadian High School Mathematics Competition)
Solution: $\because x+y+z=5$,
$$
\therefore y=5-x-z \text {. }
$$

Substitute equation (1) into $x y+y z+z x=3$, we get
$$
x(5-x-z)+(5-x-z) z+z x=3 \text {. }
$$

Rearranging gives $x^{2}+(z-5) x+\left(z^{2}-5 z+3\right)=0$.
$\because x$ is a real number,
$$
\therefore \Delta=(z-5)^{2}-4\left(z^{2}-5 z+3\right) \geqslant 0 \text {, }
$$

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.