The other answers are fine but I would like to point out that this result is also true in much greater generality, and with a non-uniform assumption on the limit, provided we simply satisfy a rectifiability condition.
Namely, let $X$, $Z$ be metric spaces, and let $f\colon X\to Z$ satisfy the infinitesimal Lipschitz condition that for each $x\in X$, we have
$$\lim_{r\to 0}\sup_{y\in X \text{, } d(x,y)\leq r} \frac{d(f(x),f(y))}{d(x,y)}=0\text{.} $$
Then $f$ is constant on every rectifiable curve in $X$. In particular, if $X$ is rectifiably connected, then $f$ is constant.
Proof
The idea here is we combine rectifiability and the point-separating nature of Lipschitz functions to reduce to the real case.
That is, on every rectifiable path $\gamma\colon[0,l(\gamma)]\to X$, parametrized by arc-length, and every $1$-Lipschitz function $L$ on $Z$, we have at each $s_0\in[0,l(\gamma)]$ that
\begin{align*}
|(L\circ f\circ\gamma)(s)-(L\circ f\circ\gamma)(s_0)| &\leq d((f\circ\gamma)(s),(f\circ\gamma)(s_0))\\
&\leq \omega(d(\gamma(s),\gamma(s_0))) \cdot d(\gamma(s),\gamma(s_0))\\
&\leq \omega(d(\gamma(s),\gamma(s_0))) \cdot |s-s_0|\text{,}
\end{align*}
where $\omega(\delta)\to 0$ as $\delta\to 0$, whereby $(L\circ f\circ \gamma)'(s_0)=0$. Thus $L\circ f\circ \gamma$ is constant on $[0,l(\gamma)]$, so that if $p,q \in \gamma([0,l(\gamma)])$, $L(f(p))=L(f(q))$. Applying this to the $1$-Lipschitz function $L(z)=d(z,f(p))$, we get that $$0=d(f(p),f(p))=d(f(q),f(p))\text{,}$$
and so $f(p)=f(q)$.
Remark
Without a condition like rectifiable connectedness, there are simple counterexamples to this result, e.g., let $X=[0,1]$ with the "snowflake" metric $d(x,y)=|x-y|^{\frac{1}{2}}$, and let $Z=\mathbb R$ with the usual metric, then let $f$ be the identity.