5. If $x$ and $y$ are non-zero real numbers, and satisfy $|x|+y=3$ and $|x| y+x^{3}=0$, then, $x+y$ equals ( ).
(A) 3
(B) $\sqrt{13}$
(C) $\frac{1-\sqrt{13}}{2}$
(D) $4-\sqrt{13}$
5.D.

Substitute $y=3-|x|$ into $|x| y+x^{3}=0$, we get $x^{3}-x^{2}+3|x|=0$.
(1) When $x>0$, $x^{3}-x^{2}+3 x=0$, the equation $x^{2}-x+3=0$ has no real roots.
(2) When $x<0$, $x^{3}-x^{2}-3 x=0$, solving gives $x=\frac{1-\sqrt{13}}{2}$.
Thus, $y=3-|x|=3+\frac{1-\sqrt{13}}{2}=\frac{7-\sqrt{13}}{2}$. Therefore, $x+y=4-\sqrt{13}$.