Let $(X, d)$ be a metric space, and $A$, $B$ be closed subsets of $X$ (not necessarily disjoint) with $A \cup B = X$.
Suppose I have a function $f : X \to Y$, for $(Y, d')$ some other metric space, and I know that $f \mid_{A}$ and $f \mid_{B}$ are both uniformly continuous (in the subspace metrics of $A$ and $B$). Does it follow that $f$ is uniformly continuous on $X$?
(EDIT: As pointed out in the comments, I should probably be assuming $X$ is complete; and it does follow that $f$ is continuous on $X$.)
(I have an ugly proof for the case $X = \mathbb{R}$, which would probably also work for an arbitrary Riemannian manifold; but I'd be interested to know if it works for general metric spaces $X$. Ideally, one would want a proof for uniform spaces without using metrics at all, but maybe that's too much to ask.)
Completeness is not enough: Let $A$ be the graph $y = 1/x$ and $B$ the graph $y = -1/x$ in the plane, and use Theo's example ($f = 1$ on $A$, $-1$ on $B$).
Because we can play the same game with any pair of disjoint, non-empty closed subsets, we really need to ensure that $$ d(A, B) = \inf \{d(a, b) : a \in A, b \in B\} $$ is positive. Compactness of either $A$ or $B$ is sufficient (exercise from Rudin's Principles of mathematical Analysis, if memory serves), but not generally necessary. (Think of subsets of a discrete metric space, where every function is uniformly continuous and all subsets are closed, but only finite subsets are compact.)