Approximating a Compact set by approximating its distance function Let $\emptyset\neq K\subset Y$ be a closed subset of a compact metric space $(X,d)$ such that $K$ has at-least two points and such that
$$
d(Y,K):=\sup_{y\in Y}\,\inf_{k\in K}\,d(k,y)=:r>0.
$$
Define $d_K(x):=\inf_{z\in K}\, d(x,z)$ and let $f:X\rightarrow [0,\infty)$ be lower semi-continuous and such that
$$
\max_{x\in X}\, \big|f(x)-d_K(x)\big|<r/2.
$$
Define the levelset $K_f:=\{x\in X:\, f(x)\leq r/2\}$ and suppose that $K_f\neq \emptyset$ (e.g. by assuming that $f^{-1}[\{0\}]\neq \emptyset$).
Is it true that $K_f\subseteq Y$?  Moreover, is the Hausdorff distance between $K_f$ and $K$ is at-most $r$?
 A: 
Is it true that $K_f\subseteq Y$?

No, not necessarily. Take, for example, take $X$ to be $2B_{\Bbb{R}^2}$, the radius $2$ closed unit disc in $\Bbb{R}^2$, and $K = B_{\Bbb{R}^2}$. Further, let
$$Y = K \cup \{(2, 0)\}.$$
Then $r = 1$. If $f = d_K$, then $K_f = \frac{3}{2}B_{\Bbb{R}^2}$, which is not a subset of $Y$.

Moreover, is the Hausdorff distance between $K_f$ and $K$ is at-most $r$?

Yes! For $\varepsilon \ge 0$, define,
$$K_{\varepsilon} = \operatorname{cl}\left\{x \in X : d_K(x) = \inf_{k \in K} d(x, k) \le \varepsilon\right\}.$$
Then, I claim that
$$K = K_0 \subseteq K_f \subseteq K_r.$$
The first equality comes from the fact that $K$ is closed in $X$. As for the two inequalities, first note that
$$|f(x) - d_K(x)| < \frac{r}{2} \implies d_K(x) < f(x) + \frac{r}{2},$$
for all $x \in X$. So, if $f(x) \le \frac{r}{2}$, we have $d_K(x) < r$, and $x \in K_r$.
On the other hand, if $x \in K$, then $d_K(x) = 0$, so
$$|f(x) - 0| < \frac{r}{2} \implies f(x) < \frac{r}{2},$$
which implies $x \in K_f$.
Now, since $K \subseteq K_f$, the Hausdorff distance between the sets is given by
$$d_H(K, K_f) = \sup_{x \in K_f} \inf_{y \in K} d(x, y) = \sup_{x \in K_f} d_K(x).$$
This is at most $r$, since $K_f \subseteq K_r$.
