Suppose we want to find the distance between the parallel lines
\[\frac{x-x_1}{a}=\frac{y-y_1}{b}=\frac{z-z_1}{c}=t_1\]
(1)\[\frac{x-x_2}{a}=\frac{y-y_2}{b}=\frac{z-z_2}{c}=t_2\]
(2)/> Rearrange (1) into vector form to give
\[\mathbf{r}_1(t_1)= \begin{pmatrix}x_1\\y_1\\z_1\end{pmatrix}+ \begin{pmatrix}a\\b\\c\end{pmatrix}t_1\]
Rearrange (2) into vector form to give
\[\mathbf{r}_2(t_2)= \begin{pmatrix}x_2\\y_2\\z_2\end{pmatrix}+ \begin{pmatrix}a\\b\\c\end{pmatrix}t_2\]
(2)-(1) gives
\[\mathbf{r}_{12}= \begin{pmatrix}x_2-x_1\\y_2-y_1\\z_2-z_1\end{pmatrix}+ \begin{pmatrix}a\\b\\c\end{pmatrix}(t_2-t_1)\]
We can take this vector as perpendicular to the tangent vector
\[\begin{pmatrix}a\\b\\c\end{pmatrix}\]
for suitable values \[t'_1, \; t'_2\]
of \[t_1, \; t_2\]
. Hence\[\begin{equation} \begin{aligned} &( \begin{pmatrix}x_2-x_1\\y_2-y_1\\z_2-z_1\end{pmatrix}+ \begin{pmatrix}a\\b\\c\end{pmatrix}(t'_2-t'_1)) \cdot \begin{pmatrix}a\\b\\c\end{pmatrix} \\ &= \begin{pmatrix}x_2-x_1+a(t'_2-t'_1)\\y_2-y_1++b(t'_2-t'_1)\\z_2-z_1+c(t'_2-t'_1)\end{pmatrix} \cdot \begin{pmatrix}a\\b\\c\end{pmatrix}=0 \end{aligned} \end{equation}\]
This gives the equation
\[\begin{equation} \begin{aligned} & a(x_2-x_1)+a^2(t'_2-t'_1)+b(y_2-y_1)+b^2(t'_2-t'_1)+c(z_2-z_1)+c^2(t'_2-t'_1)=0 \\ & \rightarrow t'_2-t'_1=- \frac{a(x_2-x_1)+b(y_2-y_1)+c(z_2-z_1)}{a^2+b^2+c^2} \end{aligned} \end{equation}\]
\[\begin{equation} \begin{aligned} \left| \mathbf{r}_{12} \right| &= \sqrt{(x_2-x_1+a(t'_2-t'_1))^2+(y_2-y_1+b(t'_2-t'_1))^2+(z_2-z_1+c(t'_2-t'_1))^2} \\ &=
\sqrt{(x_2-x_1-a( \frac{a(x_2-x_1)+b(y_2-y_1)+c(z_2-z_1)}{a^2+b^2+c^2}))^2+(y_2-y_1-b( \frac{a(x_2-x_1)+b(y_2-y_1)+c(z_2-z_1)}{a^2+b^2+c^2}))^2+(z_2-z_1-c( \frac{a(x_2-x_1)+b(y_2-y_1)+c(z_2-z_1)}{a^2+b^2+c^2}))^2}
\\ &= \sqrt{\frac{(a(x_2-x_1)+b(y_2-y_1)+c(z_2-z_1))^2}{a^2+b^2+c^2}} \end{aligned} \end{equation}\]