Let $X,Y,Z$ be topological spaces. Is the following statement true? $X \times Z \cong Y \times Z \implies X \cong Y$? how would you prove it?
and I know that if $A \cong B$, and $a \in A$ that there is a $b \in B$, such that $A\setminus{\{a\}} \cong B\setminus{\{b\}}.$ How would you prove the same for removing lines from product topology, instead of point of normal topological spaces?
In addition to the counterexamples given in Henno Brandsma's answer, there is a very pathological and very interesting counterexample: In 'A counterexample related to topological sums – Yamamoto, Shuji and Yamashita, Atsushi' a space $X$ and a space $Y$ are constructed such that $X$ and $Y$ are not homeomorphic but $X\times 2$ and $Y\times 2$ are. (By $2$ it is meant the discrete space with $2$ elements.) Notice that $X\times 2$ is just two copies of $X$, side by side, topologically unrelated to each other. Also, amazingly, $X$ and $Y$ are compact metric spaces—in fact, subspaces of $\mathbb{R}^2.$
This relates to your question in that $2\times X \cong 2\times Y$ but $X\not\cong Y$.
Also, much simpler albeit much less interesting counterexamples can be obtained with discrete spaces, e.g., $\mathbb{Z}\times 2\cong \mathbb{Z}\times 3$ but $2\not\cong 3$.