Let $f$ and $g$ be analytic on a connected open set $U$. Assume that the closed disc $\overline{D(z_0,r)}$ is contained in $U$, where $r$ is a positive number. Show that if $|f(z)|=|g(z)|$ on the circle $|z-z_0|=r$ then there is a constant $\lambda$ with $|\lambda|=1$ such that $f=\lambda g$ on $U$.
Use the Maximum modulus principle and the zeros of an analytic function.
What have you tried so far? Here is a similar problem you can check out Two non-vanishing analytic functions
It would seem that you need an additional assumption on the vanishing part.