Continuity of the function $x\mapsto d(x,A)$ on a metric space
If $a$ is in $A$, by the triangle inequality you have $$d(x,a) \leq d(x,y) + d(y,a)$$ The left hand side is at least $d(x,A)$, so we get $$d(x,A) \leq d(x,y) + d(y,a)$$ Take the infinum of this over all $a$ in $A$ and you obtain $$d(x,A) \leq d(x,y) + d(y,A)$$ Which is the same as $$d(x,A) - d(y,A) \leq d(x,y)$$ Reversing the roles of $x$ and $y$ you have $$d(y,A) - d(x,A) \leq d(x,y)$$ Combining the last two equations gives $$|d(x,A) - d(y,A)| \leq d(x,y)$$ Notice $A$ doesn't even have to be closed for this to work.
If $A = X$ (or if $\overline{A} = X$) then $d(\cdot,A) = 0$ and there's nothing to prove. If $A$ is empty, the usual conventions in the infimum yield $d(\cdot,\emptyset) = \infty$ and Lipschitz continuity doesn't really make sense. However a constant function is certainly continuous.
So, assume that $\emptyset \neq A$ and let $\varepsilon \gt 0$. Choose $a\in A$ such that $d(x,a) \leq d(x,A) + \varepsilon$. Then the triangle inequality yields $d(y,A) - d(x,A) \leq d(y,a) - d(x,a) + \varepsilon \leq d(y,x) + \varepsilon$. By symmetry we get $|d(x,A) - d(y,A)| \leq d(x,y) + \varepsilon$ and the desired result follows because $\varepsilon$ was arbitrary. Note that I didn't use that $A$ is closed. Update: Alternatively, you can choose Zarrax's way and permute two steps in this paragraph and make the argument nicer by getting rid of the explicit mentioning of $\varepsilon$ or appeal to the valuable general result mentioned by Didier.
If $A$ is non-empty and not dense, i.e., $\overline{A} \neq X$ then $1$ is in fact the best Lipschitz constant. Indeed, there are $x$ and $r\gt0$ such that $B_r(x) \cap \overline{A} = \emptyset$, so $d(x,A) \geq r \gt 0$. For every $\varepsilon \gt 0$ we can find $a \in A$ such that $d(x,a) \leq (1+\varepsilon)d(x,A)$. But then $|d(a,A) - d(x,A)| = d(x,A)\geq \frac{1}{1+\varepsilon} d(x,a)$ and the claim follows.
For a closely related thread, see here.
This is a special case of the following general situation.
Fix some nonempty set $T$ and a collection $(u_t)$ of real valued functions defined on $X$ and indexed by $t$ in $T$. Assume that each function $u_t$ is $1$-Lipschitz, that is, that for every $x$ and $y$ in $X$ and every $t$ in $T$, $|u_t(x)-u_t(y)|\leqslant d(x,y)$.
Consider the function $v=\inf\limits_{t\in T}u_t$, defined for every $x$ in $X$ by $$v(x)=\inf\{u_t(x);t\in T\}$$ Then:
- Either, $v=-\infty$ everywhere.
- Or, $v$ is finite everywhere and then $v$ is $1$-Lipschitz.
To prove this, start from the inequalities $v(x)\leqslant u_t(x)\leqslant u_t(y)+d(x,y)$ for every $x$ and $y$ in $X$ and every $t$ in $T$, and follow the lights...
In your setting, one can choose $T=A$ and $u_a=d(a,\ )$ for every $a$ in $A$. Then each function $u_a$ is nonnegative and $1$-Lipschitz, hence the function $$v=\inf\limits_{a\in A}u_a=d(A,\ )$$ is finite everywhere and $1$-Lipschitz.
Note that $A$ can be any nonempty subset of $X$.