Prove that for any two distinct points of an irreducible curve there exists a rational function that is regular at both, and takes the value 0 at one and 1 at the other.

I think I can construct such a function, for example, $u(x,y)=(x-a{)}^{2}+(y-b{)}^{2}$ for given two points $(a,b)$ and $(c,d)$. However, this doesn't work for general algebraically closed field, for example, the case of $(c,d)=(a+i,b+1)$. Hence now I have no clue. Could you give me a hint for this problem?

I think I can construct such a function, for example, $u(x,y)=(x-a{)}^{2}+(y-b{)}^{2}$ for given two points $(a,b)$ and $(c,d)$. However, this doesn't work for general algebraically closed field, for example, the case of $(c,d)=(a+i,b+1)$. Hence now I have no clue. Could you give me a hint for this problem?