The distance $f: x \mapsto \mathsf{dist}(x,\Gamma)$ to a closed set $\Gamma$ in $\mathbb{R}^n$ is differentiable in $x$ iff the nearest point projection is unique, denote this by $x_\Gamma$. In $\mathbb{R}^n$ the derivative at those points is given by $(x-x_\Gamma)/\| x-x_\Gamma\|$. Note that points in $\Gamma$ are in general not points of differentiability (points in the interior of $\Gamma$ would be, but the derivative is obviously zero).

Note that there are not properties of $\Gamma$ assumed except for closedness which is needed to show that the set of nearest point to $x$ is compact.

The statement also holds for smooth Riemannian/Finsler manifolds if one replaces nearest point projection with "unique geodesic of length $d(x,\Gamma)$ connecting $x$ and $\Gamma$.

As I couldn't find a quick reference to this fact here a small proof:

If $f$ was differentiable in $x$ then $f(y)=f(x)+v\cdot(y-x)+o(\|x-y\|)$
for some $v$. Picking $y=(1-\epsilon)x+\epsilon z$ for a point $z\in\Gamma$
with $d(x,z)=f(x)$ it holds $f(y)=(1-\epsilon)f(x)$. But then $v=(x-z)/\|x-z\|$.
In particular, the nearest point projection must be unique.

Let $(x_{n},y_{n})$ be sequences with $x_{n}\to x$ and $y_{n}\in\Gamma$
such that $d(x_{n},y_{n})=f(x_{n})$. W.l.o.g. also assume $\frac{x_{n}-x}{\|x_{n}-x\|}\to v\in\partial B_{1}(0)$.
If the nearest point projection at $x$ is unique then $y_{n}\to x_{\Gamma}$.

Now observe by convexity of $d_{z}:x\mapsto\|x-z\|$ one has
\begin{align*}
\|y-z\|-\|x-z\| & \ge\nabla d_{z}(x)\cdot(y-x)\\
& =\frac{(x-z)\cdot(y-x)}{\|x-z\|}.
\end{align*}
Thus
\begin{align*}
\frac{(x-y_{n})\cdot(x_{n}-x)}{\|x-y_{n}\|\|x_{n}-x\|} & \le\frac{\|x_{n}-y_{n}\|-\|x-y_{n}\|}{\|x_{n}-x\|}\\
& \le\frac{f(x_{n})-f(x)}{\|x_{n}-x\|}\\
& \le\frac{\|x_{n}-x_{\Gamma}\|-\|x-x_{\Gamma}\|}{\|x_{n}-x\|}.\\
\end{align*}
Taking the limit we see that the left hand side converges to $\frac{(x-x_{F})}{\|x-x_{F}\|}\cdot v$
which nothing but the derivative of $d_{x_\Gamma}$ at $x$ in direction $v$, i.e. the limit of the right hand side. Hence $f$ is
differentiable in $x$.