Let $\left(X, d_X \right)$ and $\left( Y, d_Y \right)$ be metric spaces; let $A$ and $B$ be (non-empty) closed subsets of $X$ such that $X = A \cup B$; let $f \colon A \to Y$ and $g \colon B \to Y$ be uniformly continuous functions such that $f(x) = g(x)$ for all $x \in A \cap B$; and, let the function $h \colon X \to Y$ be defined as follows: $$ h(x) \colon= \begin{cases} f(x) \ & \mbox{ if } \ x \in A, \\ g(x) \ & \mbox{ if } \ x \in B. \end{cases} $$ Then is $h$ also uniformly continuous on $X$?
I know that $h$ is continuous, even if both $f$ and $g$ were merely continuous, which is Theorem 18.3 (The Pasting Lemma) in the book Topology by James R. Munkres, 2nd edition.
My Attempt:
Let $\varepsilon > 0$ be given. We need to find a real number $\delta > 0$ such that $$ d_Y \left( h \left( x \right) , h \left( x^\prime \right) \right) < \varepsilon $$ for every pair of points $x, x^\prime \in X$ for which $$ d_X \left( x, x^\prime \right) < \delta. $$
Now if $x, x^\prime \in A$ or if $x, x^\prime \in B$, then this is of course possible.
What if $x \in A \setminus B$ and $x^\prime \in B \setminus A$?
No, it is not true.
Take $A=\{(x,1/x) \mid x>0\} \subset \mathbb{R}^2$, $B=\{(x,0) \mid x>0)\} \subset \mathbb{R}^2,$ $X:=A \cup B$. Both $A,B$ are closed in $X$, with their intersection being empty.
Now take $f:A \to \mathbb{R}$ given by $f((x,1/x))=x$, and $g:B \to \mathbb{R}$ given by $g((x,0))=2x$. Both are uniformly continuous, and satisfy the hypothesis of the alleged "pasting lemma" (coincide in the intersection). However, $h:A \cup B \to \mathbb{R}$ is not uniformly continuous. There are points arbitrarily close when you go further to the right in $A$ and $B$ and such that their images are arbitrarily distant.