We use Morera's theorem to conclude that such a function is actually holomorphic on the entire plane, and then Cauchy's integral theorem yields the vanishing of $\int_{\gamma} f(z)\,dz$ for all closed $\gamma$.
So let $\Delta \subset \mathbb{C}$ a triangle. We need to show
$$\int_{\partial \Delta} f(z)\,dz = 0.\tag{1}$$
Case $0$: $\Delta \cap \mathbb{R} = \varnothing$: In that case, Cauchy's integral theorem immediately yields $(1)$ since $f$ is holomorphic on a neighbourhood of $\Delta$.
Case $1$: $\Delta \subset \{ z \in \mathbb{Z} : \operatorname{Im} z \geqslant 0\}$. For $h \in (0,1]$, let $f_h(z) = f(z + ih)$. Since $f_h$ is holomorphic on $\{ z \in \mathbb{C} : \operatorname{Im} z > -h\}$, Cauchy's integral theorem yields
$$\int_{\partial \Delta} f_h(z)\,dz = 0,\tag{2}$$
and thus the standard estimate yields
$$\Biggl\lvert\int_{\partial\Delta} f(z)\,dz\Biggr\rvert = \Biggl\lvert \int_{\partial\Delta} f(z) - f_h(z)\,dz\Biggr\rvert \leqslant L(\partial\Delta)\cdot \max \{ \lvert f(z) - f_h(z)\rvert : z \in \partial \Delta\}.$$
Since $f$ is uniformly continuous on the compact set $\{ z\in\mathbb{C} : \operatorname{dist}(z,\Delta) \leqslant 1\}$, for every $\varepsilon > 0$ there is a $\delta > 0$ such that $\max \{ \lvert f(z) - f_h(z)\rvert : z \in \partial \Delta\} \leqslant \varepsilon$ for all $h \in (0,\delta]$, it follows that
$$\Biggl\lvert\int_{\partial\Delta} f(z)\,dz\Biggr\rvert \leqslant L(\partial\Delta)\cdot \varepsilon$$
for all $\varepsilon > 0$. But that means $(1)$ holds.
Case $2$: $\Delta \subset \{ z \in \mathbb{C} : \operatorname{Im} z \leqslant 0\}$. This case is analogous to case $1$, only we use $f_h(z) = f(z - ih)$ now.
Case $3$: $\Delta$ intersects both, the open upper and lower half-plane.
Then let $A = \Delta \cap \{ z \in \mathbb{C} : \operatorname{Im} z \geqslant 0\}$ and $B = \Delta \cap \{ z \in \mathbb{C} : \operatorname{Im} z \leqslant 0\}$. By the argument of cases $1$ and $2$, we have
$$\int_{\partial A} f(z)\,dz = 0 = \int_{\partial B} f(z)\,dz,$$
and since the segment $\Delta \cap \mathbb{R}$ occurs with opposite orientations in $\partial A$ and $\partial B$, while the remaining parts of the boundaries of $A$ and $B$ together make up the boundary of $\Delta$, we have
$$\int_{\partial\Delta} f(z)\,dz = \int_{\partial A} f(z)\,dz + \int_{\partial B} f(z)\,dz = 0 + 0 = 0.$$
So the premise of Morera's theorem is verified, and we conclude $\operatorname{Hol}(\mathbb{C}\setminus \mathbb{R}) \cap C(\mathbb{C}) = \operatorname{Hol}(\mathbb{C})$.