Given a continous real function, it is almost globally Lipschitz:

A direct proof, more in line with @Thomas's comment: Fix any $x,y\in K$ and consider two cases.

Case 1. $|x-y|<\delta$, where $\delta=\delta(\varepsilon)$ is the one given by the uniform continuity of $f$ in $K$.

Here we see that $|f(x)-f(y)|\leq \varepsilon\leq L|x-y|+\varepsilon$ for any $L>0$ (in other words, the $\varepsilon$ "error" is making it so that you gain no information locally).

Case 2. $|x-y|\geq \delta$.

Here we have that $|f(z)|\leq M$ for every $z\in K$ and some $M>0$ and so $|f(x)-f(y)|\leq 2M =(2M/\delta)\delta\leq L|x-y|$, with $L=2M/\delta$ (so in this case the $\varepsilon$ is irrelevant, rather you're exploiting only that $x,y$ are far apart and $f$ is bounded on $K$).


Could as well prove by contradiction. Suppose not. Then for some $\epsilon>0$ there exist sequences $(x_k)_{k\geq 1}$ and $(y_k)_{k\geq 1}$ in $K$ such that \begin{align} |f(x_k)-f(y_k)|\geq k\|x_k-y_k\|+\epsilon. \end{align} By compactness of $K$, we may choose a convergent subsequence of $(x_k,y_k)$. Without loss of generality, assume $(x_k)$ and $(y_k)$ have already been improved to converge to $x$ and $y$ respectively. Then \begin{align} |f(x)-f(y)|\geq k\|x-y\|+\epsilon \end{align} for all $k$, which is impossible. Note that without $\epsilon$, it is possible that $\|x-y\|=0$. Indeed, a small $\epsilon$ is significant (comparing to $L\|x-y\|$) only when $x$ and $y$ are close to each other.