A robust version of "a holomorphic function is determined by its modulus" It is well known that if $f(z)$ and $g(z)$ are both holomorphic on a (path-)connected open set $C$ and $\lvert f(z)\rvert=\lvert g(z)\rvert$ on $C$ then $f(z)=cg(z)$ on $C$ for some constant $c$. Do we have a robust version of this theorem like the following?

Suppose for simplicity $C$ is the unit disk and $\operatorname{dist}$ is some distance measure such as L2-distance. If $d=\operatorname{dist}_C(\lvert f\rvert,\lvert g\rvert)$ is small then $d'=\operatorname{dist}_{C}(f,cg)$ is also small for some $c$.

Update. Furthermore, are we able to upper bound $d'$ by $d^{O(1)}$?
Any relevant information will be greatly appreciated!
 A: You can get a robust version for free by a precompactness argument: e.g., if $\|f\|,\|g\|\leq 1$, then for any $\epsilon>0$, there exists $\delta>0$ such that $\||f|-|g|\|_{\mathbb{D}}<\delta$ implies $\|f-cg\|_{(1-\epsilon)\mathbb{D}}<\epsilon$ for some $c$. Here the norm may be $L^\infty$ or $L^2$-norm or $H_2$-norm.
Assume the contrary; then there are sequences $f_i,g_i$ and an $\epsilon>0$ such that
$$
\||f_i|-|g_i|\|\to 0;\quad 
\|f_i-cg_i\|_{(1-\epsilon)\mathbb{D}}>\epsilon\quad\forall c.
$$
Norm-boundedness for analytic function implies uniform boundedness on compact subsets of $\mathbb{D}$, so by passing to a subsequence we may assume that $f_i\to f$ and $g_i\to g$ uniformly on compact subsets of $\mathbb{D}$. But then $|f|\equiv|g|$ but $\|f-cg\|_{(1-\epsilon)\mathbb{D}}\geq\epsilon$ for all $c$, a contradiction.
Update there is a lazy way to obtain the following more concrete bound:

for each $f$ analytic in the unit disc, and each $\epsilon>0$, there exist $C>0$ such that $$\inf_{c\in\mathbb{C}}\|f-cg\|_{(1-\epsilon)\mathbb{D}}\leq C\||f|-|g|\|_\mathbb{D}.$$ Let's work with supremum norms for concreteness.

To illustrate the idea, assume first that $f$ has no zeros. Then, $g$ also has no zeros in $(1-\epsilon)\mathbb{D}$ provided $d=\||f|-|g|\|_\mathbb{D}<\inf_{(1-\epsilon)\mathbb{D}}|f|$. This implies that $\log f$ and $\log g$ are analytic functions, and moreover for any $r\in(1-\epsilon/2,1)$, we have $$\sup_{|z|=r}|\Re (\log f(z) - \log g(z))|\leq C_1 d$$
for some constant $C_1$ depending only on $\inf_{|z|=r}|f(x)|$. By Harnack's estimates for the derivatives of harmonic functions, this means
$$\sup_{|z|\leq 1-\epsilon}|(\log f(z)-\log g(z))'|\leq C_2 d,$$
with $C_2$ depending only on $C_1$ and $\epsilon$. Finally, we integrate this inequality and note that the exponential is a locally  Lipschitz function. This gives
$$
\sup_{|z|\leq 1-\epsilon}\left|f(z) - \frac{f(0)}{g(0)}g(z)\right|\leq C_3 d,
$$
where $C_3$ now may depend on $\epsilon$ and on $f$, via $\sup_{|z|\leq 1-\epsilon}|f(z)|$ and $\inf_{|z|\leq r}|f(z)|$).
If $f$ has zeros, it does not really matter since near them both $|f|$ and $|g|$ are small. We choose $r$ in the above proof so that $f$ has no zeros on the circle $|z|=r$. For $d$ small enough, the level line of $|f|=2d$ has a small loop around each zero. Removing the interior of each loop, we run the same argument over the resulting domain. The only difference is that we don't know a priori that $\log f-\log g$ is single-valued, but that doesn't matter, as it is enough to estimate the difference over some fixed sheet. If $d$ is not "small enough", then the bound is trivial by taking $C$ large enough.
