Suppose $f$ is not injective in $D(0,r)$. Let $z_0,z_1\in D(0,r)$ distinct such that $f(z_0)=f(z_1)=w.$
Let $1>\rho>r$ and denote $\partial D(0,\rho)$ by $\gamma.$ Define $g(z)=f(z)-w$ and notice that $g$ has at least two zeros in $D(0,\rho)$. The winding number
$$\begin{align}n(g(\gamma),0)=&\frac{1}{2\pi i}\int_{g(\gamma)}\frac{1}{z}\,dz\\
=&\frac{1}{2\pi i}\int_0^{2\pi}\frac{g'(\gamma(t))}{g(\gamma(t))}\gamma'(t)\,dt\\
=&\frac{1}{2\pi i}\int_{\gamma}\frac{g'(z)}{g(z)}\,dz,
\end{align}$$
which by the Argument principle yields that
$$\begin{align}n(g(\gamma),0)=&\sum_{a\in D(0,\rho)}\operatorname{ord}_g(a)\cdot n(\gamma,a)\\\geq&\,2. \end{align} $$ That is, $g(\gamma)$ self intersects. But since $\text{Im}(\gamma)\subset U$, and $f$ is injective in $U$, we reach a contradiction.