5. In the rectangular prism $A B C D-A_{1} B_{1} C_{1} D_{1}$, $A B=$ $A A_{1}=1, A D=2$. Then the distance between the skew lines $A_{1} D$ and $B_{1} D_{1}$ is ( ).
(A) 1
(B) $\frac{1}{2}$
(C) $\frac{2}{3}$
(D) $\frac{3}{2}$
5. C.

Let $A_{1} B$ and $A B_{1}$ intersect at point $O$, and draw $B_{1} M \perp D O$ at point $M$.
Since $A_{1} B \perp A B_{1}, A_{1} B \perp A D$, therefore, $A_{1} B \perp$ plane $A D C_{1} B_{1} \Rightarrow A_{1} B \perp B_{1} M$. Also, $B_{1} M \perp D O$, thus, $B_{1} M \perp$ plane $A D B$. Given $B_{1} D / / B D$, we know $B_{1} D / /$ plane $A D B$.
Therefore, $B_{1} M$ is the distance between $A_{1} D$ and $B_{1} D_{1}$.
$$
\begin{array}{l}
\text { By } O B_{1}=\sqrt{\left(\frac{1}{2}\right)^{2}+\left(\frac{1}{2}\right)^{2}}=\frac{\sqrt{2}}{2}, \\
B_{1} D=\sqrt{1^{2}+1^{2}+2^{2}}=\sqrt{6}, \\
O D=\sqrt{\left(\frac{1}{2}\right)^{2}+\left(\frac{1}{2}\right)^{2}+2^{2}}=\frac{3 \sqrt{2}}{2},
\end{array}
$$

we get $\cos \angle B_{1} O D=\frac{O B_{1}^{2}+O D^{2}-B_{1} D^{2}}{2 O B_{1} \cdot O D}=-\frac{1}{3}$
$\Rightarrow \sin \angle B_{1} O M=\frac{2 \sqrt{2}}{3}$
$\Rightarrow B_{1} M=O B_{1} \sin \angle B_{1} O M=\frac{2}{3}$.