5. As shown in Figure 2, a square $E F G H$ with side length 1 is moving on the plane of a square $A B C D$ with side length 3, always keeping $E F / / A B$. The midpoints of segments $C F$ and $D H$ are $M$ and $N$, respectively. Then the length of segment $M N$ is ( ).
(A) $\frac{\sqrt{10}}{2}$
(B) $\frac{\sqrt{17}}{2}$
(C) $\frac{\sqrt{17}}{3}$
(D) $\frac{2 \sqrt{10}}{3}$
5. B.

As shown in Figure 6, connect $C G$, take the midpoint $T$ of $C G$, and connect $M T$ and $T N$.

Since $M$ is the midpoint of $C F$, $M T$ is the midline of $\triangle G C F$, so,
$$
\begin{array}{l}
M T / / F G, \\
M T=\frac{F G}{2}=\frac{1}{2} .
\end{array}
$$

Similarly,
$$
\begin{array}{l}
N T / / G H, \\
N T=\frac{G H+C D}{2}=2 .
\end{array}
$$

Also, $\angle M T N=\angle F G H=90^{\circ}$, then by the Pythagorean theorem we get
$$
M N^{2}=M T^{2}+N T^{2}=2^{2}+\left(\frac{1}{2}\right)^{2}=\frac{17}{4} .
$$

Therefore, $M N=\frac{\sqrt{17}}{2}$.