Example 4 (53rd Romanian Mathematical Olympiad (1st Round)) Find all real functions $f, g, h: \mathbf{R} \rightarrow \mathbf{R}$, such that for any real numbers $x, y$, we have
$$
(x-y) f(x)+h(x)-x y+y^{2} \leqslant h(y) \leqslant(x-y) g(x)+h(x)-x y+y^{2} .
$$
From equation (1), we get $(x-y) f(x) \leqslant (x-y) g(x)$. It is easy to see that $f(x)=g(x)$ for all real numbers $x$. Therefore, we have
$$
(x-y) f(x)+h(x)-x y+y^{2}=h(y).
$$

Let $x=0$, we get $h(y)=y^{2}-f(0) y+h(0)$, which means $h$ is a quadratic function. Define $f(0)=a, h(0)=b$, and substitute $h(y)=y^{2}-a y+b$, we have
$$
(x-y) f(x)+x^{2}-a x+b-x y+y^{2}=y^{2}-a y+b,
$$

which simplifies to $(x-y) f(x)+x(x-y)-(x-y) a=0$.
Since $x$ and $y$ are arbitrary real numbers, we have $f(x)=-x+a$.
Upon verification, $f(x)=g(x)=-x+a, h(x)=x^{2}-a x+b$ satisfy the conditions, where $a$ and $b$ are real constants, and $x \in \mathbf{R}$.