2. The range of the function $y=\frac{\sin 2 x-3}{\sin x+\cos x-2}$ is
2. $[2-\sqrt{2}, 2+\sqrt{2}]$.

Notice that,
$$
\begin{aligned}
y & =\frac{\sin 2 x-3}{\sin x+\cos x-2} \\
& =\frac{(\sin x+\cos x)^{2}-4}{\sin x+\cos x-2} \\
& =\sin x+\cos x+2 .
\end{aligned}
$$

Since $-\sqrt{2} \leqslant \sin x+\cos x \leqslant \sqrt{2}$, therefore,
$$
2-\sqrt{2} \leqslant y \leqslant 2+\sqrt{2} \text {. }
$$