Yes. Let $C$ be the closed complement of $U$, then by excision of $C$ we have $H_1(\mathbb{R}, \mathbb{R} - K) = H_1(U, U - K)$; since $H_1(\mathbb{R})=0$, you also have in fact $H_1(\mathbb{R}, \mathbb{R}-K)= H_1(U, U-K)= 0$ when $\mathbb{R}-K$ is connected. So $H_0(U-K)$ injects into $H_0(U)$ and $U-K$ must be connected.