3. As shown in Figure 1, in the right triangle $\triangle ABC$, $AC=3, BC=$ $4, D$ is a moving point on the hypotenuse $AB$, $DE \perp BC, DF \perp$ $AC$, with the feet of the perpendiculars being $E$ and $F$ respectively. When the length of segment $EF$ is minimized, $\cos \angle EFD=(\quad$.$) .$
(A) $\frac{3}{5}$
(B) $\frac{4}{5}$
(C) $\frac{3}{4}$
(D) $\frac{\sqrt{7}}{4}$
3. A.

Connect $C D$. It is easy to know that quadrilateral $D E C F$ is a rectangle.
Therefore, $E F=C D$.
To make the length of line segment $E F$ the smallest, $C D \perp A B$ is required. By the Pythagorean theorem, $A B=5$.
Thus, $\cos \angle E F D=\cos \angle B C D$ $=\cos \angle B A C=\frac{3}{5}$.