Is the pasting lemma also true in case of uniform continuity? 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$? 
 A: The case $X = \mathbb{R}^n$ is true. More generally, whenever $X$ has the property that every ball is path connected, this Pasting Lemma holds. Indeed, given $\epsilon > 0$, there exists $\delta > 0$ such that
$$x, y \in A \ \ \text{and}\ \  d(x, y) < \delta \implies d(f(x), f(y)) < \frac{\epsilon}{2}\\
x, y \in B \ \ \text{and}\ \  d(x, y) < \delta \implies d(g(x), g(y)) < \frac{\epsilon}{2}$$
Then, if $x \in A$ and $y \in B$, with $d(x, y) < \delta/2$, we can choose a point $z \in B(x; \delta/2)$ that is in $A \cap B$ (consider the path connecting $x$ and $y$ inside the ball). We have
$$d(x, z) <\delta, \quad d(z, y) < \delta$$
Therefore
$$d(h(x), h(y)) \leq d(f(x), f(z)) + d(g(z), g(y)) < \frac{\epsilon}{2} + \frac{\epsilon}{2} = \epsilon$$
The uniform continuity follows.
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.
