This easily follows form the definition of subharmonic functions as upper semicontinuous functions with the local sub-mean property, which is obviously local and the equivalence of the two definitions is a standard part of theory.
(so for all $w \in D$ and all $r$ small enough depending on $w$ we have $f(w)\le \frac{1}{2\pi}\int_0^{2\pi}f(w+re^{it}) dt$)
Here is a proof using the maximum principle for usc functions, namely that on any compact set $K$ there is $w_K$ st $f(w_K) =\max_{z\in K}f(z)$ which is a standard property of usc functions and follows from the fact that usc is equivalent to the preimages of $(-\infty, a)$ being open for all $a$ real as well as the fact that usc functions can be decreasingly approximated by continuous functions on any compact (and more generally on any set) which is a bit more involved but part of the theory.
So assume $u$ locally subharmonic as above and pick $K, h$ as in the OP, so $h$ harmonic on the interior on $K$ and $u \le h$ on $\partial K$ and we need to prove $u \le h$ on $K$.
Then $g=u-h$ is usc since $h$ is continuous so $-h$ is continuous hence usc and the sum of two usc functions is usc, so $g$ attains its maximum on $K$. If that is at most $0$ we are done, but if not there is $w$ in the interior of $K$ st $g(w)>0$ and $g(w) \ge g(z)$ for all $z \in K$ as $g\le 0$ on the boundary.
Take a small disc $D_w$ centered at $w$ and included in the interior of $K$ on which $u$ (hence $g$) is subharmonic and note that if $C_w$ is the boundary circle, we have $g(w) \ge g(z), z\in C_w$. Since $g|_{C_w}$ is usc there is a sequence of continuous functions $g_n$ converging decreasingly to $g$ on $C_w$ hence if $g_n$ is also their harmonic extension to $D_w$ we have $g \le g_n$ on $C_w$ hence $g \le g_n$ on $D_w$.
But by the mean value theorem for harmonic functions we have $$g_n(w)=\frac{1}{2\pi}\int_0^{2\pi}g_n(w+re^{it}) dt$$ where $r$ is the radius of $D_w$ and by the monotone convergence theorem $$\int_0^{2\pi}g_n(w+re^{it}) dt \to \int_0^{2\pi}g(w+re^{it}) dt$$ hence putting it together we get $$\frac{1}{2\pi}\int_0^{2\pi}g(w+re^{it})dt \le g(w) \le \frac{1}{2\pi}\int_0^{2\pi}g(w+re^{it})dt$$ so we must have equality and $g(w)=g(z), z \in C_w$. But clearly, we can take any smaller radius $r_1<r$ and repeat so $g$ is constant on $D_w$.
From here a standard argument shows that $g$ must be constant positive at least on the component $K_1$ of the interior of $K$ containing $w$ and that is impossible since if $z_n \to z \in \partial K_1$ we have $0 \ge g(z) \ge \lim g(z_n)=g(w)>0$ etc
(take $K_1$ the component of the interior of $K$ containing $w$ and $A$ the set of $\zeta$ where $g(\zeta)=\max_{z \in K_1}g(z)$ and $\zeta$ has a small neighborhood on which $g$ is constant and immediately it follows that $A$ is open and closed as $z_n \to z$ implies $\limsup g(z_n) \le g(z)$ by usc, while the above shows it is nonempty, so $A=K_1$ hence $g$ is constant on $K_1$)