Prove that $U=\{x \in X\mid d(x,A)<d(x,B)\}$ is open when $A$ and $B$ are disjoint

$f(x)=d(x,B)-d(x,A)$ is continuous and $U=f^{-1}(x:x>0)$


Your strategy will not work in an arbitrary metric space. Consider for example $ X = \mathbb R \setminus\{0\}$ with the usual distance and then $A=\{-1\}$, $B=\{1\}$. Then your $C$ is empty.

Instead, consider something like the ball around $x\in U$ of radius $\frac12(d(x,B)-d(x,A))$.

(Tsemo Aristide's suggestion is slicker than this, if you already know that $d(x,A)$ is a continuous function of $x$ and that preimages of open sets under continuous functions are open).