What is a continuous function on the rationals that hasn't a continuous extension on the reals?
Consider the function $f$ sending every rational $<\pi$ to $0$ and sending every rational $>\pi$ to $1$.
As a function from $\mathbb{Q}$ to $\mathbb{Q}$ (with the usual metric/topology on $\mathbb{Q}$) this is continuous: for every rational $a$, we can take a small enough positive $\epsilon$ so that $\pi\not\in (a-\epsilon,a+\epsilon)$ and then $f$ is constant on this interval. But it obviously has no continuous extension to all of $\mathbb{R}$.
Some remarks:
The key point re: continuity is the fact that $\pi$ is not rational: if we try to do the same thing replacing $\pi$ with $17$, the continuity claim breaks down (take $a=17$).
Meanwhile, the key point re: nonextendibility - which I didn't justify, since it's "obvious" - is that there are rationals arbitrarily close to $\pi$. If I had a "big gap" instead of a "single missing point," I'd have "room" to "connect everything up nicely" (yay scarequotes!).
And the above observations together point at the relationship between $\mathbb{R}$ and $\mathbb{Q}$.
The restriction of the composition of $ℝ → ℝ,~x ↦ x - \sqrt 2$ and $ℝ\setminus \{0\} → ℝ,~x ↦ 1/x$ to the rationals has no extension to $ℝ$, that is the map $$ℚ → ℝ,~x ↦ \frac 1 {x - \sqrt 2}.$$
Let $f(x) = 0$ if $x<\pi$, and $f(x) =1$ otherwise. Since every rational has a positive distance from $\pi$, this function is continuous on the rationals. It clearly cannot be extended to a continuous function on the reals.