This post will explain why in the post of @levap , the distance preserving map $\tilde{\varphi}$ fails to be smooth.
The key point is: the space $\mathbb R$ with distance $d(x,y)=|x^3-y^3|$ (which can be induced by metric tensor $g=9x^4$) is a Riemannian manifold with metric non-degenerate everywhere but at $x=0$. If you check Myers and Steenrod's original paper published in 1938: The group of isometry of a Riemannian manifold, or Richard Palais's proof in On the differentiability of isometry. In both paper, the metric of Riemannian manifold is supposed to be non-degenerate.
Let's have a look at the Riemannian manifold $(\mathbb R, g)$, with $g=9x^4$ (which induce the distance $d(x,y)=|x^3-y^3|$) and see how degeneracy at $x=0$ fails the smoothness, it's metric tensor is induced by the heomemorphism (but NOT diffeomorphism) $\varphi:x\to x^3$, since the tangent map $\varphi_*=3x^2$ vanish at $x=0$, so it's pullback metric tensor vanish at $x=0$. Also, if we remove the point $x=0$, the manifold has geodesic $\gamma(x)=x^{1/3}$, but this geodesic cannot be extended to $x=0$, since otherwise its tangent vector will be $\dot{\gamma}(0)=\lim_{x\to 0}\frac13x^{-2/3}=\infty$. Thus, there is no geodesic passing $x=0$, so one cannot define exponential map at $x=0$. But the exponential map is the essential tool the proof required, so the proof will fail if the tensor metric vanish at $x=0$.
This counterexample shows that Mayers-Steenrod theorem fails in the Riemannian manifolds with degenerate metric tensor.