Under mild conditions on the metric space $(X,d)$, we can assure that either $f$ is constant or $f$ is injective, so $f$ is either trivial or behaves similar to an isometry. Let $\simeq$ be the equivalence relation on $X$ where we set $x\simeq y$ iff $f(x)=f(y)$. Let $U$ be an equivalence class of $\simeq$, and suppose that $U$ has more than one point. Let $r_U$ be the supremum of all real numbers $r$ such that for each $x\in U$, there exists some $y\in U$ with $d(x,y)\geq r$.
Proposition: $r_A\geq\text{Diam}(A)/2$ for any set $A$ with metric $d$.
Proof: Suppose that $s<\text{Diam}(A)$. Then there are $u,v\in A$ with $d(u,v)>s$. If $x\in A$, then $d(x,u)>s/2$ or $d(x,v)>s/2$, since if $d(x,u)\leq s/2,d(x,v)\leq s/2$, then $d(u,v)\leq s$ by the triangle inequality. Q.E.D.
In particular, $r_U>0$.
If $(X,d)$ is a metric space, then we say that a subset $C\subseteq X$ is $\epsilon$-uniformly clopen if whenever $x\in C$, we have $B_\epsilon(x)\subseteq C$.
Observation: If $C\subseteq X$, then $C\subseteq X$ is $\epsilon$-uniformly clopen if and only if $C^c$ is $\epsilon$-uniformly clopen.
Proof: $C\subseteq X$ is $\epsilon$-uniformly clopen iff
$\forall x,y\in X,d(x,y)<\epsilon\rightarrow(x\in C\rightarrow y\in C)$ iff
$\forall x,y\in X,d(x,y)<\epsilon\rightarrow(y\in C^c\rightarrow x\in C^c)$ iff
$C^c$ is $\epsilon$-uniformly clopen.
Q.E.D.
In particular, every $\epsilon$-uniformly clopen set is clopen. We say that a subset of a metric space is uniformly clopen if it is $\epsilon$-uniformly clopen for some $\epsilon>0$. We say that a metric space is uniformly connected if the only uniformly clopen sets are the empty set and the entire space.
Observation: The set $U$ is $r_U$-uniformly clopen.
Proof: Suppose that $x\in U$ and $d(x,y)\leq r_U$. Then there is some $z\in U$ with
$d(x,z)\geq r_U$. Therefore, $d(f(x),f(y))\leq d(f(x),f(z))=0$ since $x\simeq z$. Therefore, $f(x)=f(y)$, so $y\in U$ as well. Q.E.D.
Therefore, if $(X,d)$ is uniformly connected and $d(x,y)\leq d(x,z)\Rightarrow d(f(x),f(y))\leq d(f(x),f(z))$, then either $f$ is injective or $f$ is constant.