Example 1 Find the range of real number $a$ such that for any real number $x$ and any $\theta \in\left[0, \frac{\pi}{2}\right]$, the inequality $(x+$ $3+2 \sin \theta \cdot \cos \theta)^{2}+(x+a \sin \theta+a \cos \theta)^{2} \geqslant \frac{1}{8}$ always holds.
(1996 National High School League Question)
Solve: Using the non-negativity of a quadratic function, we know that its discriminant $\Delta \leqslant 0$, thus it is easy to know that the original inequality is equivalent to
$$
(3+2 \sin \theta \cdot \cos \theta-a \sin \theta-a \cos \theta)^{2} \geqslant \frac{1}{4}
$$
for any $\theta \in\left[0, \frac{\pi}{2}\right]$.
From (1), we can get $a \geqslant \frac{3+2 \sin \theta \cdot \cos \theta+\frac{1}{2}}{\sin \theta+\cos \theta}$, for any $\theta \in\left[0, \frac{\pi}{2}\right]$,

or $a \leqslant \frac{3+2 \sin \theta \cdot \cos \theta-\frac{1}{2}}{\sin \theta+\cos \theta}$, for any $\theta \in\left[0, \frac{\pi}{2}\right]$,
Under condition (2), since $\theta \in\left[0, \frac{\pi}{2}\right]$, therefore $1 \leqslant \sin \theta+\cos \theta \leqslant \sqrt{2}$.
Also, $\frac{3+2 \sin \theta \cdot \cos \theta+\frac{1}{2}}{\sin \theta+\cos \theta}=(\sin \theta+\cos \theta)+\frac{5}{2} \cdot \frac{1}{\sin \theta+\cos \theta}$,
and when $1 \leqslant x \leqslant \sqrt{2}$, $f(x)=x+\frac{5}{2} \cdot \frac{1}{x}$ is a decreasing function,
so $a \geqslant \max _{\theta \in\left[0, \frac{\pi}{2}\right]} \frac{3+2 \sin \theta \cdot \cos \theta+\frac{1}{2}}{\sin \theta+\cos \theta}=1+\frac{5}{2}=\frac{7}{2}$.
Under condition (3), since $\frac{3+2 \sin \theta \cdot \cos \theta-\frac{1}{2}}{\sin \theta+\cos \theta}=(\sin \theta+\cos \theta)+\frac{3}{2} \cdot \frac{1}{\sin \theta+\cos \theta} \geqslant$
$2 \cdot \sqrt{\frac{3}{2}}=\sqrt{6}$, and the equality holds when $\sin \theta+\cos \theta=\frac{\sqrt{6}}{2}$, thus $\max _{\theta \in\left[0, \frac{\pi}{2}\right]} \frac{3+2 \sin \theta \cdot \cos \theta-\frac{1}{2}}{\sin \theta+\cos \theta}=\sqrt{6}$, hence $a \leqslant \sqrt{6}$.
In summary, we know that $a \geqslant \frac{7}{2}$ or $a \leqslant \sqrt{6}$ is the required range of $a$.