3. Given that the difference between the two roots of the equation $x^{2}+p x+q=0$ is equal to the difference between the two roots of the equation $x^{2}+q x+p=0$. Then, apart from $p^{2}-4 q>0$ and $q^{2}-4 p>0$, the relationship that $p$ and $q$ should have is $(\quad)$.
(A) $p+q=4$
(B) $p=-q$
(C) $p+q=-4$ or $p=q$
(D) $p+q=4$ or $p=-q$
3.C.

Let the roots of the equation $x^{2}+p x+q=0$ be $\alpha_{1} 、 \alpha_{2}$, and the roots of the equation $x^{2}+q x+p=0$ be $\beta_{1} 、 \beta_{2}$. Then
$$
\begin{array}{l}
\alpha_{1}+\alpha_{2}=-p, \alpha_{1} \alpha_{2}=q ; \\
\beta_{1}+\beta_{2}=-q, \beta_{1} \beta_{2}=p .
\end{array}
$$

From the given condition, we know $\left|\alpha_{1}-\alpha_{2}\right|=\left|\beta_{1}-\beta_{2}\right|$, that is,
$$
\sqrt{\left(\alpha_{1}+\alpha_{2}\right)^{2}-4 \alpha_{1} \alpha_{2}}=\sqrt{\left(\beta_{1}+\beta_{2}\right)^{2}-4 \beta_{1} \beta_{2}} \text {. }
$$

Therefore, $(-p)^{2}-4 q=(-q)^{2}-4 p$, which means
$$
p^{2}-q^{2}+4(p-q)=0 \text {. }
$$

Thus, $p+q=-4$ or $p=q$.