Why is $f(x) = x^2$ uniformly continuous on [0,1] but not $\mathbb{R}$

The comments and other answer address the uniform continuity on compact sets. @hermes points out the crux of your proof, that $|x + x_0| < 2$, cannot be extended to all of $\mathbb{R}$. Turns out there is no fix for that.

Let $\varepsilon = 1$. We need to show that for all $\delta > 0$, there exist $x,y$ such that $|x - y| < \delta$ but $|f(x) - f(y)| > 1$. The key is the dependence of $x$ and $y$ on $\delta$. To this end, let $\delta > 0$ be given, and choose $y = x + \frac{\delta}{2}$. Then $|x-y| = \frac{\delta}{2} < \delta$, but $$|f(x) - f(y)| = |x^2 - y^2| = \left|x^2 - \left(x^2 + x\delta + \frac{\delta^2}{4}\right)\right| = \left|x\delta + \frac{\delta^2}{4}\right|,$$ and for sufficiently large (or small) $x \in \mathbb{R}$, we can make the last quantity larger than 1. Hence we do not have uniform continuity on $\mathbb{R}$.


$x^2$ is uniformly continuous on $[0,1]$ because continuous functions are always uniformly continuous on a compact set.

In your proof, you need $|x+x_0|<2$ to prove uniform continuity, which is true on $[0,1]$ but not on $\mathbb{R}$. So the proof cannot be extended to $\mathbb{R}$.