# Counterexample to domain additivity of uniformly continuous function

What I'm looking for is a counter-example to the following question:

Let $$A,B\subseteq\mathbb{R}$$ be closed sets and $$f$$ a real-valued function of a real variable such that its restrictions to $$A$$ and $$B$$ respectively are uniformly continuous. Is $$f$$ uniformly continuous on $$A\cup B$$?

Those are my considerations so far:

$$A$$ and $$B$$ must be unbounded, otherwise, they would be compact and so would be their union. Thus, since $$f$$ is surely continuous on $$A\cup B$$, $$f$$ would be uniformly continuous as well.

$$A$$ and $$B$$ cannot be unbounded intervals, otherwise, we can prove again (by an $$\epsilon-\delta$$ argument) that $$f$$ is uniformly continuous on $$A\cup B$$.

$$A$$ and $$B$$ cannot have the discrete topology (like $$\mathbb{N}\subseteq\mathbb{R}$$), otherwise uniform continuity is immediate.

This is easily achieved by considering infinite unions instead of finite ones, so I'm not interested in that either.

Could somebody provide any hint on what I could try? Also, the counter-example can be as complex as needed (supposing I didn't miss something very trivial) so feel free to do your "worst".

Let $$A=\mathbb N$$, let $$B=\{n+2^{-n-1}:n\in\mathbb N\}$$, and let $$f$$ be identically $$0$$ on $$A$$ and identically $$1$$ on $$B$$.