Given two points $x,y$ in a separated scheme $X$, is there always some function on an open set containing both that distinguishes them?

I'm relatively new to schemes (just started Hartshorne chapter II), and the following question seemed natural to me but I could not determine an answer. Suppose $$X$$ is a separated scheme and $$x,y$$ are two distinct points in $$X$$. Is there always an open set $$U\subset X$$ containing $$x,y$$ and a function $$f\in \mathcal{O}_X(U)$$ so that $$f(x)=0$$ and $$f(y)\neq 0$$ (or the reverse)?

If $$X$$ is affine, say $$\operatorname{Spec} A$$, I think I understand why this has to be the case: saying $$x\notin\overline{\{y\}}$$ is the same thing as saying that the prime ideal corresponding to $$y$$ is not a subset of the prime ideal correpsonding to $$x$$, so we can pick some $$f$$ in the prime ideal corresponding to $$y$$ which isn't in the prime ideal corresponding to $$x$$, and this function vanishes at $$y$$ but not $$x$$. This also handles the case where $$x,y$$ are in a common affine open. But I don't know if $$x,y$$ are always in a common affine open.

Progress: The problem can be reduced to $$X$$ integral (if $$x,y$$ are in different irreducible components, then we can find disjoint neighborhoods and take an indicator function, and nilpotents don't affect the evaluation of functions). Since any two open sets of an irreducible space intersect and the intersection of two affine opens in a separated scheme is again an affine open, we may assume that $$X$$ is the union of $$\operatorname{Spec} A_1$$, containing $$x$$, and $$\operatorname{Spec} A_2$$, containing $$y$$, with intersection $$\operatorname{Spec} B$$ containing neither $$x$$ nor $$y$$. From here the global functions on $$X$$ are the functions in $$A_1\times A_2$$ which lie in the kernel of $$A_1\times A_2\to B$$ by subtracting the images of their components. I don't see how to get the desired function from this, though.
• My first thought is that a line with a double point (at the origin) could give a counterexample. Unfortunately my copy of Hartshorne is inaccessibly in my office. I should, of course, know this without consulting it, but I'm very rusty. The problem could simply be that in this case the functions defined on any open $U$ containing both origins must come from the same rational function, and hence agree on both versions of the origin. Nov 6 '20 at 8:09