Suppose for contradiction that $f$ is continuous but not uniformly continuous on $[a,b]$. Then there exists $\varepsilon > 0$ such that for every $n \in \mathbb{N}$ there exist $x_n, y_n \in [a,b]$ with $|x_n - y_n| < \frac{1}{n}$ and $|f(x_n) - f(y_n)| \ge \varepsilon$. By the Bolzano-Weierstrass theorem, the sequence $(x_n)$ has a convergent subsequence $(x_{n_k})$; say $x_{n_k} \to x \in [a,b]$. Now you have
$$
|y_{n_k} - x| \le |y_{n_k} - x_{n_k}| + |x_{n_k} - x| \le \frac{1}{n_k} + |x_{n_k} - x| \to 0
$$
and so $y_{n_k} \to x$ as well.
Since $f$ is continuous at $x$ and since $x_{n_k}, y_{n_k} \to x$, we have $f(x_{n_k}) \to f(x)$ and $f(y_{n_k}) \to f(x)$. In particular, there exists $k$ such that $|f({x_{n_k}}) - f(x)| < \varepsilon/2$ and $|f(y_{n_k}) - f(x)| < \varepsilon/2$. So the triangle inequality forces $|f(x_{n_k}) - f(y_{n_k})| < \varepsilon$, which contradicts the choice of the sequences $x_n$ and $y_n$.