For $f(x)=x$ and $D=(-\infty,a) \cup (b,+\infty), \ a $f$ is uniformly continuous on $D$ and not bounded on it.
Maybe you are looking for a bounded set $D$ s.t. $f$ is uniformly continuous and unbounded on $D$. You cannot find such $f$.
Or (equivalently) if you are asking:
What are the conditions on $D$ such that if $f$ is uniformly continuous on $D$ then $f$ is bounded?
then the answer is $\text{$D$ must be bounded.}$
For the proof we will use the following
If f is uniformly continuous on $D$ then f is Cauchy-continuous on D.
Or, if you want, if $f$ is uniformly continuous on $D$ then sends Cauchy sequences on $D$ to Cauchy sequences.
Now suppose that $D$ is bounded and $f$ is uniformly continuous and unbounded on $D$. Then $\forall n \in \mathbb{N}$ we can find an $x_n \in D$ such that $|f(x_n)|>n$. (Obviously) $f(x_n)$ does not have a Cauchy subsequence. Since $D$ is bounded and $(x_n)_{n \in \mathbb{N}} \subseteq D \Rightarrow (x_n)_{n \in \mathbb{N}}$ is bounded so from Bolzano–Weierstrass theorem it has a Cauchy subsequence, lets say $(x_{k_n})_{n \in \mathbb{N}} $. So we found a Cauchy sequence $(x_{k_n})_{n \in \mathbb{N}} $ such that $f(x_{k_n})_{n \in \mathbb{N}} $ is not Cauchy. Contradiction.