Let us first see what is continuity. Given a positive $\epsilon$, continuity of $f$ means that at each $x$, we can find a small $\delta$ such that $x'\in (x-\delta,x+\delta)$ implies $f(x')\in (f(x)-\epsilon,f(x)+\epsilon)$. So around each $x$, we have a small open set that is mapped very close to $f(x)$. Also note that points in the same small open set are mapped to points close to each other, since they are both mapped to points close to $f(x)$. But the problem here is that this radius of the open sets $\delta$ depends on the point $x$.
Now compactness means you can find a finite collection of such small open sets that they cover the support of the function, and this is good enough for us. Because among these finitely many open sets, you can determine the smallest radius, say $r$. If the distance between $x$ and $x'$ are less than $1/10r$, then you know they must lie in the same open set, then $f(x)$ and $f(x')$ must be close. Now this $r$ does not depend on $x$, you have uniform continuity.
Let us start with
$$h(x) = \begin{cases}
\hphantom{-}4(x+2) &, -2\leqslant x < -\frac{3}{2}\\
-4(x+1) &, -\frac{3}{2} \leqslant x < -1\\
-4(x-1) &,
\hphantom{-}\; 1 \leqslant x < \frac{3}{2}\\
\hphantom{-} 4(x-2) &,
\hphantom{-}\frac{3}{2}\leqslant x < 2\\
\qquad 0 &,
\hphantom{-} \text{ otherwise.} \end{cases}$$
For $c > 0$, let
$$h_c(x) = c\cdot h(c\cdot x).$$
Then $h_c$ is continuous, and $\int_{-\infty}^0 h_c(x)\,dx = 1$ as well as $\int_{-\infty}^\infty h_c(x)\,dx = 0$. Now let
$$g(x) = \sum_{n=1}^\infty h_{5^n}\left(x-n-\frac{1}{2}\right).$$
Every $g_n(x) = h_{5^n}\left(x-n-\frac12\right)$ vanishes identically outside the interval $[n,n+1]$, so $g$ is continuous, and
$$f(x) = \int_0^x g(t)\,dt$$
is well-defined and continuously differentiable.
Furthermore, $f(x) \equiv 0$ on every interval $\left[n, n+\frac{1}{2} - \frac{2}{5^n}\right]$, and $f(x) \equiv 1$ on every interval $\left[n+\frac{1}{2}-\frac{1}{5^n}, n+\frac{1}{2}+\frac{1}{5^n}\right]$. Thus on
$$X = \bigcup_{n=1}^\infty \left(\left[n, n+\frac{1}{2} - \frac{2}{5^n}\right] \cup \left[n+\frac{1}{2}-\frac{1}{5^n}, n+\frac{1}{2}+\frac{1}{5^n}\right]\right)$$
we have $f' \equiv 0$, so the derivative is bounded, but
$$f\left(n+\frac{1}{2}-\frac{1}{5^n}\right) - f\left(n+\frac{1}{2}-\frac{2}{5^n}\right) = 1$$
for all $n$, while the distance between the two points is $5^{-n}$ which becomes arbitrarily small, so $f$ is not uniformly continuous on $X$.
If the sentence
Note that $X$ cannot be an interval, a disjoint union of intervals, nor can it be a discrete set.
was meant to forbid a construction as above where $X$ is a disjoint union of intervals, we can obey the letter of the law (but not the spirit) by adding an arbitrary subset of $(-\infty,0)$ that is not a union of disjoint intervals.
Best Answer
There is an infinite number of items in your union, so you can't take the min so easily. You could have $\delta=0$. You have the good idea, but we need to construct the finite union. We will assume U closed, because we can always do the same on the closure of U.
Given $\epsilon>0$ and $x_0=\min U$, we will define $\forall n,\ x_n=\max\left\{ { x\in \left[x_{n-1}, \infty \right] } \mid { \lvert f(x)-f(x_{n-1})\rvert\leq\epsilon } \right\}$. Note that $x_n$ can be equal to $\infty$. $\left(x_n\right)$ is stritly incresing, so converge to $x_\infty \in \mathbb R_+ \cup \{\infty\}$. If $x_\infty \neq \infty$, then $f$ is not continuous in $x_\infty$, which is not possible.
We have $U $ bounded, and $x_n \rightarrow +\infty$, so $\exists n_0, \forall n>n_0, x_{n} \notin U $. Now $U \subset \bigcup_{i=0}^{n_0} [x_i, x_{i+1}]$ and you have your finite union.