Fixing proof that if $\overline{A}\cap B=A\cap\overline{B}=\varnothing$, there exists $U,V$ such that $A\subset U$ and $B\subset V$ I tried to prove the following theorem:

Let $X$ be a metric space and $A,B\subset X$. Suppose that $\overline{A}\cap B=A\cap\overline{B}=\varnothing$. Then there exists two disjoint open sets $U$ and $V$ such that $A\subset U$ and $B\subset V$.

My proof was the following:

If $a\in A$, there exists $r_a>0$ such that $B(a,r_a)\cap B=\varnothing$. Otherwise, we would have $a\in\overline{B}$. (We could construct a sequence in $B$ that converges to $A$.) Similarly, if $b\in B$, there exists $r_b>0$ such that $B(b,r_b)\cap A=\varnothing$. Let
      $$\;\;U=\bigcup_{a\in A}B(a,\epsilon r_a) \;\text{ et }\; V=\bigcup_{b\in B} B(b,\epsilon r_b),$$
      where $\epsilon>0$ will be chosen later. Clearly, $A\subset U$ and $B\subset V$. If $U\cap V$ were not empty, there would exist $x\in B(a,\epsilon r_a)\cap B(b,\epsilon r_b)$, where $a\in A$ and $b\in B$. So, by the triangular inequality:
      $$d(a,b)\leq d(a,x)+d(b,x)<\epsilon(r_a+r_b).$$
      Since $a\notin \overline{B}$, $d(a,B)>0$. However, if we take $\epsilon=d(a,B)/(r_a+r_b)$ we have 
      $$f_B(a)\leq d(a,b)<\epsilon (r_a+r_b)=f_B(a),$$
      which is absurd!

Now, I realised that I cannot take such $\epsilon$ since $a$ and $b$ depend on it. It seems intuitive to me that every $0<\epsilon<1$ would work but I can't figure out how to prove it.
 A: Your proof is almost fine, but however it does not work for any $\varepsilon \in ]0,1[$ : in $\mathbb{R}$, take $A=\{0\}$ and $B=\{1\}$. Then you can have $r_0=r_1=1$, but with $\varepsilon > \frac{1}{2}$, the open sets $B(0,\varepsilon\cdot r_0)$, $B(1,\varepsilon\cdot r_1)$ are not disjoint !
To make your proof correct : note that it works with $\varepsilon\in ]0,\frac{1}{2}]$.
Indeed, it would give you at the end of your proof $d(a,b)<\frac{1}{2}(r_a+r_b)$, but by definition, $A$ does not intersect $B(b,r_b)$, so you have $d(a,b) \ge r_b$ and similarly $d(b,a) \ge r_a$.
This gives you $d(a,b) < d(a,b)$ : absurd.
A: As a remark into general topology: being able to separate such sets $A$ and $B$ by open sets, is called being "completely normal" and in all spaces this is equivalent to the fact that all subspaces of $X$ are normal (hereditarily normal). See e.g. here or here.
And as all metrisable spaces are normal, and all subspaces of metrisable spaces are metrisable, all metrisable spaces are hereditarily normal so completely normal: we can separate all $A$ and $B$ with $\overline{A} \cap B = \emptyset = A \cap \overline{B}$ by disjoint open sets.
