I am doing exercise 33.5 of Munkres:
Exercise 33.6: Theorem (Strong form of Urysohn Lemma). Let $X$ be a normal space. There is a continuous function $f : X \to [0,1]$ such that $f(x) = 0$ for all $x\in A$ , and $f(x) = 1$ for all $x \in B$, and $0 < f(x) < 1$ otherwise iff $A$ and $B$ are disjoint closed $G_\delta$ sets in $X$.
Now the existence of such a function immediately gives that $A$ and $B$ are closed $G_\delta$ sets since $$A = f^{-1}\left( \bigcap_{n\geq 1} B_{\frac{1}{n}}(0)\right)$$
and similarly for $B$. Now for the other direction, I have also proved it but only using the fact that one of $A$ or $B$ is $G_\delta$. How did I do this? Well by exercise 4 of the same section there is $f : X \to [0,1]$ such that $f(x) = 0$ for all $x \in A$ and $f(x) > 0$ for all $x \notin A$ since $A$ is $G_\delta$. By the Urysohn Lemma, there is $g(x) : X\to [0,1]$ such that $g|_B = 0$ and $g|_A = 1$. Then $$h(x) = \frac{g(x)}{f(x) + g(x)}$$ is the required function.
My question is: For this direction of the problem, is it a superfluous condition that we need both $A$ and $B$ to be $G_\delta$?
Thanks.