With the metric $d(x,y)=|x-y|$ on $\Bbb Q$ and the topology on $\Bbb Q$ generated by $d$: For $q\in K$ let $r(q)=\min (q-\sqrt 2\,,\sqrt 3 -q\,).$ Let $K(q)=\{q'\in \Bbb Q: d(q',q)<r(q)\}.$
Then $K(q)$ is open in $\Bbb Q$ and $q\in K(q)\subset K.$
So $\cup_{q\in K}K(q)$ is open in $\Bbb Q.$ And we have $K=\cup_{q\in K}
\,\{q\}\subset \cup_{q\in K}\,K(q)\subset \cup_{q\in K}\,K=K,$ so $K=\cup_{q\in K}K(q)$ is open in $\Bbb Q.$
An easily overlooked point about this Q:
(i). Let $T$ be a topology on a set $X$ and let $Y \subset X.$ The subspace topology $T|Y$ on $Y$ is defined as $T|Y=\{t\cap Y:t\in T\}. $ If $B$ is a base (basis) for $T$ then $B|Y=\{b\cap Y: b\in B\}$ is a base for $T|Y.$
(ii).Suppose $T$ is generated by a metric $d$ on $X,$ so that the set $B$ of open $d$-balls of $X$ is a base for $T$. So $B|Y$ is a base for $T|Y.$
BUT in general $B|Y$ may NOT be the set of open $d$-balls of $Y.$ An open $d$-ball of $Y$ is $B_d^Y(y,r)=\{y'\in Y: d(y',y)<r\},$ for some $y\in Y, $ which does belong to $B|Y,$ but there may be other members of $B|Y.$
For example in your Q, with $X=\Bbb R$ and $Y=\Bbb Q$ and $d(u,v)=|u-v|,$ the set $K$ belongs to $B|Y$ but is not an open ball of $\Bbb Q$ because $(\sqrt 2 +\sqrt 3)/2\not \in \Bbb Q.$
(iii). In the general case, for metric spacess it is a useful, widely used result that every member of $B|Y$ is a union of open $d$-balls of $Y,$ so the subspace topology $T|Y,$ as a subspace of $X,$ co-incides with the topology on $Y$ generated by the metric $d|_{Y\times Y}.$