Are locally homotopic functions homotopic?

Take spheres for example. The identity and constant map from $S^n$ to itself satisfy the condition. Because one can always choose $V$ relatively small compared to $U$, so that we can use geodesics to construct the local homotopy.