For the sake of having an answer, here's a slightly different argument.
For each $n$ there are $k_n \in K$ and $f_n \in F$ such that $d(K,F) \leq d(k_n,f_n) \leq d(K,F) + 1/n$ by definition of the infimum. Since $K$ is compact, we may pass to a subsequence $k_{n_i} \to k \in K$. For $\varepsilon \gt 0$ we can ensure for $i$ large enough that $d(k,f_{n_i}) \leq d(k,k_{n_i})+d(k_{n_i},f_{n_i}) \leq d(K,F) + \varepsilon$. Since the intersection $F'$ of $F$ with the closed ball of radius $d(K,F)+\varepsilon$ around $k$ is compact and $f_{n_i} \in F'$ we can pass to a further subsequence such that $f_{n_i}$ converges to some $f \in F' \subset F$. Then $$d(K,F) \leq d(k,f) = \lim_{i \to \infty} d(k_{n_i},f_{n_i}) \leq \lim_{i \to \infty} \left(d(K,F) + \frac{1}{n_i} \right)= d(K,F)$$
proves that $d(k,f) = d(K,F)$ as desired. (this works for any of the metrics you're interested in)
Notice that we used compactness crucially twice. First for passing to a subsequence $k_{n_i}\to k$ and then we used compactness of closed balls to conclude that the intersection of some closed ball with the closed set $F$ is compact and thus we could pass to a further subsequence.
Without assuming that either one of $F$ or $K$ is compact, the statement you ask about becomes wrong. For instance the subsets $F = \mathbb{N}$ and $K = \{n+1/n: n\in\mathbb{N}, n \geq 2\}$ of $\mathbb{R}$ have $d(K,F) = 0$ but as $F \cap K = \emptyset$ there are no points $f \in F$ and $k \in K$ such that $d(k,f) = 0 = d(K,F)$.
Here are three related threads that you might find interesting:
The first one is the one I erroneously identified as a duplicate, the second one shows that the distance function $d(\cdot,A)$ from a non-empty set is continuous and the third one shows in particular that for answering your question the ingredient that closed and bounded sets are compact (a special feature of $\mathbb{R}^n$, also called the Heine-Borel property) is crucial, too.