4. In a convex quadrilateral $ABCD$, $P$ and $Q$ are the centroids of $\triangle ABC$ and $\triangle ADC$, respectively, and $PQ \perp AC$. If the lengths of three of the four sides are $5$, $6$, and $7$, then the length of the fourth side is . $\qquad$
4. $2 \sqrt{3}$ or $2 \sqrt{15}$ or $\sqrt{38}$.

As shown in Figure 5, take the midpoint $M$ of $A C$. Then $B, P, M$ and $D, Q, M$ are collinear respectively.
Since $\frac{B P}{P M}=2$
$$
=\frac{D Q}{Q M},
$$

therefore, $P Q \parallel B D$.
Also, $P Q \perp A C$, so $B D \perp A C$.
Thus, $A B^{2}+C D^{2}=B C^{2}+D A^{2}$.
Therefore, the length of the fourth side is
$$
\sqrt{5^{2}+6^{2}-7^{2}}=\sqrt{12}=2 \sqrt{3} \text {, }
$$

or $\sqrt{6^{2}+7^{2}-5^{2}}=\sqrt{60}=2 \sqrt{15}$,
or $\sqrt{7^{2}+5^{2}-6^{2}}=\sqrt{38}$.