Such functions are usually called affine-linear maps.
$f$ must be injective (as for all $b\ne c$ we must have $f(b)\ne f(c)$).
Suppose $f$ is not monotonic, say we have $x<y<z$ and $f(x)<f(y)>f(z)$. If $f(z)<f(x)$ then $|f(z)-f(x)|<|f(z)-f(y)|$ whereas $|z-x|>|z-y|$, contradiction. Similarly, we arrive at a contradiction when $f(z)>f(x)$, or when $f(x)>f(y)<f(z)$. We conclude that $f$ is monotonic.
Consider $a\in \Bbb R$ and let $u:=\inf_{t>a} |f(t)-f(a)|$. For any $c>a$ we can let $b=\frac{c+2a}3$ and, using monotonicity, conclude $|f(c)-f(a)|=|f(c)-f(b)|+|f(b)-f(a)|>2|f(b)-f(a)|\ge 2u$. As this holds for any $c>0$, we conclude that $u\ge2u$, i.e., $u=0$. Similarly, we conclude $\inf_{t<a} |f(t)-f(a)|=0$ and so that $f$ is a continuous monotonic function.
Using continuity, we conclude that $$\tag1|a-b|=|b-c|\implies |f(a)-f(b)|=|f(b)-f(c)|$$ by observing what happens as $c$ varies.
Fix $n\in \Bbb N$ and let $\alpha=n(f(\frac1n)-f(0))$. Then using $(1)$ and injectivity, we find by induction that $$\tag2f(x)=\alpha x+f(0) $$
for all $x=\frac kn$, $k\in \Bbb Z$
As $1\in \frac 1n\Bbb Z$ for all $n$, the $\alpha$ in $(2)$ must be the same for all $n$ and we conclude that $(2)$ holds for all $x\in \Bbb Q$.
By continuity, $(2)$ holds for all $x\in \Bbb R$.