Solution: Let $f: Z = X \cup Y \to [0,1]$ be a homeomorphism. Look at the figure below.
The space $X \cup Y$
Let $f(p) = q$. If we remove the point $p$ from $Z$, then the restriction of $f$ on $Z\setminus \{ p \} $ will also be homeomorphism between $Z\setminus \{ p \} $ and $[0,1]\setminus \{ q \} $. Note that the space $[0,1]\setminus \{ q \} $ has at most two connected components whereas the space $Z\setminus\{ q \} $ has three connected components.
The space $Z \setminus \{p\}$
Thus the restriction of $f$ can not be a homeomorphism between $Z\setminus \{ p \} $ and $[0,1]\setminus \{ q \} $ and hence, $f$ can not a homomorphism. So we proved that the space $Z$ and $[0,1]$ are not homeomorphic.