Example 6 Given that $x, y$ are real numbers, and $x^{2}+x y+$ $y^{2}-2=0$. Then the range of $x^{2}-x y+y^{2}$ is $\qquad$
(1996, Hubei Province Huanggang Region Junior High School Mathematics Competition)
Solution: Let $x^{2}-x y+y^{2}=k$ (i.e., introduce the parameter $k$), and combine with the given conditions to get
$$
x y=\frac{2-k}{2},(x+y)^{2}=\frac{6-k}{2} \text {. }
$$
$\therefore$ When $6-k \geqslant 0$, i.e., $k \leqslant 6$, we have
$$
x+y= \pm \sqrt{\frac{6-k}{2}} \text {. }
$$

Thus, $x$ and $y$ are the two real roots of the equation in $t$
$$
t^{2} \mp \sqrt{\frac{6-k}{2}} t+\frac{2-k}{2}=0
$$

Therefore,
$$
\Delta=\frac{6-k}{2}-4 \times \frac{2-k}{2} \geqslant 0 .
$$

Solving this, we get $k \geqslant \frac{2}{3}$.
Hence, $\frac{2}{3} \leqslant x^{2}-x y+y^{2}=k \leqslant 6$.