5. In $\triangle A B C$, $\angle A \leqslant \angle B \leqslant \angle C$, $\frac{\sin A+\sin B+\sin C}{\cos A+\cos B+\cos C}=\sqrt{3}$.

Then the range of $\angle B$ is ( ).
(A) $\left(\frac{\pi}{3}, \frac{\pi}{2}\right)$
(B) $\left(0, \frac{\pi}{2}\right)$
(C) $\frac{\pi}{3}$
(D) $\left(\frac{\pi}{4}, \frac{\pi}{3}\right]$
5.C.

From the condition, we have
$$
\begin{array}{l}
\sin A + \sin B + \sin C = \sqrt{3} (\cos A + \cos B + \cos C) \\
\Rightarrow 2 \sin \frac{A+C}{2} \cdot \cos \frac{A-C}{2} + \sin B \\
\quad = \sqrt{3} \left(2 \cos \frac{A+C}{2} \cdot \cos \frac{A-C}{2} + \cos B\right) \\
\Rightarrow \left(2 \sqrt{3} \cos \frac{A+C}{2} - 2 \sin \frac{A+C}{2}\right) \cos \frac{A-C}{2} \\
= \sin B - \sqrt{3} \cos B .
\end{array}
$$

Using the auxiliary angle formula, we get
$$
\begin{array}{l}
2 \sin \left(\frac{\pi}{3} - \frac{A+C}{2}\right) \cos \frac{A-C}{2} = \sin \left(B - \frac{\pi}{3}\right) \\
\Rightarrow 2 \sin \left(\frac{B}{2} - \frac{\pi}{6}\right) \cos \frac{A-C}{2} \\
\quad = 2 \sin \left(\frac{B}{2} - \frac{\pi}{6}\right) \cos \left(\frac{B}{2} - \frac{\pi}{6}\right) \\
\Rightarrow 2 \sin \frac{B-60^{\circ}}{2} \left(\cos \frac{A-C}{2} - \cos \frac{B-60^{\circ}}{2}\right) = 0 \\
\Rightarrow \sin \frac{B-60^{\circ}}{2} \cdot \sin \frac{A-C+B-60^{\circ}}{4} \cdot \sin \frac{B-A+C-60^{\circ}}{4} = 0 .
\end{array}
$$

Therefore, $\angle B - 60^{\circ} = 0$ or $\angle A - \angle C + \angle B - 60^{\circ} = 0$ or $\angle B - \angle A + \angle C - 60^{\circ} = 0$, which means $\angle B = 60^{\circ}$ or $\angle C = 60^{\circ}$ or $\angle A = 60^{\circ}$, i.e., one of $\angle A, \angle B, \angle C$ is $60^{\circ}$.

If $\angle B = 60^{\circ}$, then $\angle C \geqslant \angle B > 60^{\circ}$, so it can only be that $\angle A = 60^{\circ}$, thus $\angle A + \angle B + \angle C > 180^{\circ}$, which is also a contradiction.