Example 7 Given $x \geqslant 0, x^{2}+(y-2)^{2}=1$. Find
$$
W=\frac{3 x^{2}+2 \sqrt{3} x y+5 y^{2}}{x^{2}+y^{2}}
$$

the maximum and minimum values.
Notice that
$$
W-2=\frac{(x+\sqrt{3} y)^{2}}{x^{2}+y^{2}}=\frac{4\left(\frac{x+\sqrt{3} y}{2}\right)^{2}}{\left(\sqrt{x^{2}+y^{2}}\right)^{2}}
$$

the numerator can be regarded as the square of the distance from point $P(x, y)$ to the line $l: x+\sqrt{3} y=0$, and the denominator is the square of the distance from point $P$ to the origin. Therefore, the original problem can be transformed using geometric meaning. Draw $P A \perp l$ at point $A$, and let $\angle A O P=\theta$. It is easy to know that $60^{\circ} \leqslant \theta \leqslant 90^{\circ}$, $|P A|=\left|\frac{x+\sqrt{3} y}{2}\right|$, and $|O P|=\sqrt{x^{2}+y^{2}}$.
. Therefore, $\sin \theta=\frac{|P A|}{|O P|}$, $\frac{\sqrt{3}}{2} \leqslant \sin \theta \leqslant 1$.
At this point, $W-2=4 \sin ^{2} \theta \in[3,4]$.
It is known that when $x=0, y=3$, $W$ reaches its minimum value of 5; when $x=\frac{\sqrt{3}}{2}, y=\frac{3}{2}$, $W$ reaches its maximum value of 6.