Suppose $X$ is a topological space and $A\cup B$ is a disconnected subset of $X$ where $(A,B)$ is a separation of $A\cup B$.
Does this imply the existence of a continuous function $f : X \rightarrow [0,1]$ such that $f(A)=0$ and $f(B)=1$?
If not, what kind of additional conditions are needed?