5. Given $\frac{\sin \theta}{\sqrt{3} \cos \theta+1}>1$. Then the range of $\tan \theta$ is $\qquad$

Translate the text above into English, please keep the original text's line breaks and format, and output the translation result directly.
5. $(-\infty,-\sqrt{2}] \cup\left(\frac{\sqrt{3}}{3}, \sqrt{2}\right]$.

From the condition, we have
$$
\frac{\sin \theta}{\sqrt{3} \cos \theta+1}>1 \Leftrightarrow \frac{\sin \theta}{\cos \theta+\frac{\sqrt{3}}{3}}>\sqrt{3}
$$

This represents the slope of the line connecting a moving point $P(\cos \theta, \sin \theta)$ on the unit circle to the point $M\left(-\frac{\sqrt{3}}{3}, 0\right)$ being greater than $\sqrt{3}$.

By drawing the diagram, we find that point $P$ moves on the arcs $\overparen{A B}$ and $\overparen{C D}$, including points $A\left(-\frac{\sqrt{3}}{3}, \frac{\sqrt{6}}{3}\right)$ and $C\left(-\frac{\sqrt{3}}{3},-\frac{\sqrt{6}}{3}\right)$, but excluding points $B(0,1)$ and $D\left(-\frac{\sqrt{3}}{2},-\frac{1}{2}\right)$. See Figure 1.

The $\tan \theta$ represents the slope of the line connecting the origin to point $P$. From the diagram, after calculation, we get
$$
\tan \theta \in(-\infty,-\sqrt{2}] \cup\left(\frac{\sqrt{3}}{3}, \sqrt{2}\right]
$$