Here is Prob. 21, Chap. 4 in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition:
Suppose $K$ and $F$ are disjoint sets in a metric space $X$, $K$ is compact, $F$ is closed. Prove that there exists $\delta > 0$ such that $d(p, q) > \delta$ if $p \in K$, $q \in F$. Hint: $\rho_F$ is a continuous positive function on $K$.
Show that the conclusion may fail for two disjoint closed sets if neither is compact.
My effort:
By Prob. 20, Chap. 4, in Baby Rudin, 3rd edition, we know that the function $\rho_F \colon X \to \mathbb{R}$ given by $$ \rho_F (x) \colon= \inf \left\{ \ d(x, z) \ \colon z \in F \ \right\} \ \mbox{ for all } x \in X$$ is uniformly continuous on $X$, and moreover $$\rho_F(x) = 0 \ \iff \ x \in \overline{F} = F$$ since $F$ is closed.
But as $K$ and $F$ are disjoint, so we must have $$\rho_F(x) > 0 \ \mbox{ for all } \ x \in K.$$ Thus the restriction $\rho_F \vert_K$ of the uniformly continuous function $\rho_F$ to $K$ is a uniformly continuous function whose range is a subset of $(0, +\infty)$.
But as $K$ is compact, so the set $$\left\{ \ \rho_F(x) \ \colon \ x \in K \ \right\},$$ which is a (uniformly) continuous image of $K$, is a compact subset of $\mathbb{R}^1$.
Therefore the set $$\left\{ \ \rho_F(x) \ \colon \ x \in K \ \right\}$$ is a closed and bounded subset of $\mathbb{R}^1$, so this set has a maximum and a minimum element in $\mathbb{R}$; But this set is a subset of $(0, +\infty)$.
Thus we can conclude the existence of positive real numbers $\lambda$ and $\mu$ such that $$ \lambda = \rho_F(a) \ \mbox{ and } \ \mu = \rho_F(b) \ \mbox{ for some points } a, b \in K, \ \tag{2} $$ and $$\lambda \leq \rho_F(x) \leq \mu \ \mbox{ for all } \ x \in K. \tag{2} $$ Let $\delta$ be any real number such that $$ 0 < \delta < \lambda. \ \tag{3} $$ Let $p \in K$ and $q \in F$ be arbitrary. Then from (2) and (3) we see that $$\delta < \lambda \leq \rho_F(p) = \inf \left\{ \ d(p, z) \ \colon \ z \in F \ \right\} \leq d(p, q), $$ which implies that $$d(p, q) > \delta$$ for all $p \in K$, $q \in F$. Is this proof correct?
Now let $$F_1 = \left\{ \ (x, y) \in \mathbb{R}^2 \ \colon \ xy= 1 \ \right\},$$ and let $$ F_2 = \left\{ \ (x, y) \in \mathbb{R}^2 \ \colon \ y= 0 \ \right\}.$$ Then $F_1$ and $F_2$ are two disjoint closed sets in the Euclidean space $\mathbb{R}^2$, but neither of $F_1$ and $F_2$ is compact (since although both are closed, neither is bounded). Am I right?
However, for any real number $x \neq 0$, we see that $$ d_{\mathbb{R}^2} \left( \ (x, 0), \ \left( x, \frac{1}{x} \right) \ \right) = \sqrt{ \frac{1}{x^2} } = \left\vert \frac{1}{x} \right\vert \to 0$$ as $x \to \pm\infty$, which implies that, by taking $x$ sufficiently large (in absolute value), the last distance can be made smaller than any given positive real number $\delta$, no matter how small. Am I right?
Is my proof sound enough? And if so, then is my counter-example good enough too?
Can we provide any counter-examples in $\mathbb{R}^1$ also?
Yes. Your proof doesn't need uniform continuity - if $f$ is continuous and $K$ is compact, then $f(K)$ is compact.
Your counter-example with $F_1$ and $F_2$ is fine, too.