5. If $x \in [0, \pi]$, then the range of the function
$$
y=\frac{\sin x \cdot \cos x}{1+\sin x+\cos x}
$$

is
5. $\left[-1, \frac{\sqrt{2}-1}{2}\right]$.

Let $t=\sin x+\cos x$. Then $\sin x \cdot \cos x=\frac{t^{2}-1}{2}$.
Thus, $y=\frac{t-1}{2}$.
Also, $t=\sqrt{2} \sin \left(x+\frac{\pi}{4}\right)$, and $\frac{\pi}{4} \leqslant x+\frac{\pi}{4}<\frac{5 \pi}{4}$, so $\sin \left(x+\frac{\pi}{4}\right) \in\left[-\frac{\sqrt{2}}{2}, 1\right]$, which means $t \in[-1, \sqrt{2}]$.
Therefore, $y \in\left[-1, \frac{\sqrt{2}-1}{2}\right]$.