Urysohn's lemma in general topology states:
A topological space $X$ is normal (i.e., $T_4$) iff, for each pair of disjoint closed subsets $C, D \subset X$, there is a function $f : X \to [0, 1]$ such that $f(C) = 0$ and $f(D) = 1$.
Of course Urysohn's proof relies heavily on the structure of $[0, 1]$, to go through, but I wondered how necessary this is. In particular, let's say
A space $Y$ is said to "have property $\mathscr{U}$" if, for every compact Hausdorff space $X$, and every pair of disjoint subsets $C, D \subset X$, there exists a continuous map $f : X \to Y$ such that there are $y_1 \neq y_2 \in Y$ with $f(C) = y_1$ and $f(D) = y_2$.
Question: Can we characterize those spaces with property $\mathscr{U}$?
Urysohn's lemma says that any space containing a line segment has property $\mathscr{U}$. Is this sufficient condition in fact necessary?
(Of course we could define a similar property replacing "compact Hausdorff" with "normal." I'm directly interested in the former situation, but I don't have any idea which is the "correct" definition to make.)
Motivation: I've recently learned the following cute result: Let $X$ be a compact Hausdorff space and $F$ be a topological field. Then there is a continuous bijection $$\varphi : X \to \operatorname{MaxSpec} C(X, F),$$ where the space on the right is endowed with the Zariski topology. Of course $\varphi^{-1}$ will usually be far from continuous, since the Zariski topology is fairly weak. However, when $F = \mathbb{R}$ then $\varphi$ is a homeomorphism. To see this, we verify directly that $\varphi$ is a closed map using Urysohn's lemma.
I'm wondering if this allows us to give a characterization of the real numbers as a topological field that's essentially different from the usual ones.