Topology question about a special subset in $\mathbb R^2$

Your solution will not work. Any neighbourhood $W$ of $X$ which contains both $(0,1)$ and $(0,0)$ can be disconnected either by the open sets $\{(x,y)|y>\frac12\}$ and $\{(x,y)|y<\frac12\}$ or if there exists $n\in\mathbb{N}$ with $(\frac1n,\frac12)\in W$, by the open sets $\{(x,y)|x<\frac1n\}$ and $\{(x,y)|x>\frac1{n+1}\}$.

Instead you can use the following argument:

If $U$ and $V$ separate $X$, then each vertical line $L_n=\{\frac1n\}\times [0,1]$ is connected, so by the result you mentioned completely contained in $U$ or $V$.

Any neighbourhood $U$ of $(0,0)$ will intersect all vertical lines $L_n$ for all $n>m_1$ for some $m_1$.

Similarly, any neighbourhood $V$ of $(0,1)$ will intersect all vertical lines $L_n$ for all $n>m_m$ for some $m_2$.

Thus if $U,V$ separate $X$, they will each contain all $L_n$ for $n>\max(m_1,m_2)$, yielding the desired contradiction.