6. Let the coordinates of $C$ and $D$ be $\left(y_{1}^{2}, y_{1}\right),\left(y_{2}^{2}, y_{2}\right)$, respectively. From the problem, we have $B-C=(D-C) \mathrm{i}$, which gives the coordinates of $B$ as $\left(y_{1}^{2}+y_{1}-y_{2}, y_{2}^{2}-y_{1}^{2}+y_{1}\right)$.
Substituting into the line equation, we get $y_{2}^{2}-2 y_{1}^{2}+y_{2}-4=0$,
and $\frac{y_{1}-y_{2}}{y_{1}^{2}-y_{2}^{2}}=1$, solving which yields $y_{1}=-1, y_{2}=2$ or $y_{1}=-2, y_{2}=3$.
Thus, the area of the square is $|C D|^{2}=18$ or $|C D|^{2}=50$.
6. As shown in Figure $21-13$, one side $AB$ of the square $ABCD$ lies on the line $y=x+4$, and the vertices $C$ and $D$ are on the parabola $y^{2}=$ $x$. Find the area of the square $ABCD$.