Continuity is quite clear one you know that $f(x) = d(x,A)$ is continuous, and so is $f'(x) = d(x,B)$.
Check that $A \cap B = \emptyset$ implies that $d(x,A) + d(x,B) > 0$. This uses that $x \in \overline{X}$ iff $d(x,X) = 0$ for subsets of $X$.
So we have a quotient of continuous functions (you need that division and addition are continuous on the real numbers), which is continuous.
b) follows from pulling back disjoint neighbourhoods of $0$ and $1$ under this $g$.