5. As shown in Figure 1, the side length of square $ABCD$ is $1$, and $E$ and $F$ are the midpoints of sides $BC$ and $AD$, respectively. Fold $\triangle ABF$ along the line $BF$ and fold $\triangle CDE$ along the line $DE$. Then, during the folding process, the maximum distance between points $A$ and $C$ is $\qquad$
5. $\sqrt{2}$.

In square $ABCD$, connect $AC$, intersecting $BF$ and $DE$ at points $G$ and $H$ respectively.
Then, during the folding process, there is always
$$
AC \leqslant AG + GH + HC = \sqrt{2} \text{, }
$$

When $\triangle ABF$ and $\triangle CDE$ are coplanar, the equality holds.