Example 1 Let $O(0,0), A(1,0), B(0,1)$, and $P$ be a moving point on the line segment $AB$, $\overrightarrow{A P}=\lambda \overrightarrow{A B}$. If
$$
\overrightarrow{O P} \cdot \overrightarrow{A B} \geqslant \overrightarrow{P A} \cdot \overrightarrow{P B} \text {, }
$$

then the range of the real number $\lambda$ is $\qquad$ .
$(2007$, National High School Mathematics League, Henan Province Preliminary (Grade 11))
From the given conditions, we have
$$
\begin{array}{l}
\overrightarrow{A P}=\overrightarrow{A B}=(-\lambda, \lambda), \text { and } 0 \leqslant \lambda \leqslant 1, \\
\overrightarrow{O P}=\overrightarrow{O A}+\overrightarrow{A P}=(1-\lambda, \lambda) .
\end{array}
$$

Therefore, $\overrightarrow{P A}=(\lambda,-\lambda)$,
$$
\overrightarrow{P B}=\overrightarrow{P O}+\overrightarrow{O B}=(\lambda-1,1-\lambda) \text {. }
$$

From $\overrightarrow{O P} \cdot \overrightarrow{A B} \geqslant \overrightarrow{P A} \cdot \overrightarrow{P B}$, we get
$$
\lambda-1+\lambda \geqslant \lambda(\lambda-1)-\lambda(1-\lambda),
$$

which simplifies to $2 \lambda^{2}-4 \lambda+1 \leqslant 0$.
Solving this, we get $1-\frac{\sqrt{2}}{2} \leqslant \lambda \leqslant 1+\frac{\sqrt{2}}{2}$.
Combining this with $0 \leqslant \lambda \leqslant 1$, the range of $\lambda$ is
$$
\left[1-\frac{\sqrt{2}}{2}, 1\right] \text {. }
$$