I'm having trouble understanding the notion of uniform continuity, the definition states as follows: Let $f: D\to\mathbb{R}$, $f$ is uniformly continous in $X\subset D$ if: $$\forall\varepsilon >0, \exists\delta >0:\left ( \forall x_1, x_2\in X, |x_1 - x_2|<\delta\Rightarrow |f(x_1)-f(x_2)|<\varepsilon\right ) $$
In other words, if a function is uniformly continous in $X$ then it is continous in $X$, but the contrary might not always be true.
As an example, consider $f(x) = x^2$. Fix $\varepsilon =1$, then we can consider $$x_1 =\frac{1}{\delta}, x_2 = \frac{1}{\delta} + \frac{\delta}{2}\Rightarrow |x_1-x_2 |= \frac{\delta}{2}<\delta\Rightarrow |x^2_1 - x^2_2| > 1 $$
But now Cantor's theorem on uniform continuity states that if $f$ is continous in a closed interval $[a,b]$, then it is also uniformly continous in $[a,b]$.
Did we not just provide an example of a closed interval $[\frac{1}{\delta}, \frac{1}{\delta}+\frac{\delta}{2}]$ where uniform continuity is not satisfied?
No, we didn't. This argument shows that $f$ is not uniformly continuous in all $\mathbb{R}$. See that, indeed, we are denying definition of uniformly continuous:
There is an $\epsilon>0$ (in this case $\epsilon=1$) such that for all $\delta>0$ there are $x,y\in\mathbb{R}$ satisfying $|x-y|<\delta$ and $|f(x)-f(y)|\ge\epsilon$ ($x=1/\delta$ and $y=1/δ+δ/2$ on this case).