I will give an example when two spaces are not homeomorphic. The example is similar to the one in the linked answer by Ronnie Brown.
Remark. My example is the same as in Example 7, Section 22 of
Munkres, James R., Topology., Upper Saddle River, NJ: Prentice Hall. xvi, 537 p. (2000). ZBL0951.54001.
But Munkres (just like Brown) only proves that the product map is not a quotient map.
Lemma 1. Let $p: [0,1]\to S^1$ be the standard quotient map for the equivalence relation $0\sim 1$. Then the product map
$$
p\times id : [0,1]\times {\mathbb Q}\to S^1\times {\mathbb Q}
$$
is a closed map, hence, a quotient map.
In the next lemma, I again identify $S^1$ and $[0,1]/\{0,1\}$.
Lemma 2. Suppose that $h: [0,1]\times ((t_1, t_2)\cap{\mathbb Q})\to S^1\times \mathbb{Q}$ is a "shearing" continuous map with
$$
h(0,y)= [(0, y)],
$$ for all $y\in (t_1, t_2)\cap \mathbb Q$. Then for every irrational $a\in \mathbb (t_1, t_2)$ there exists a sequence $z_i=(x_i,y_i)\in T=(0,1)\times ((t_1, t_2)\cap \mathbb Q)$ converging to $z=(0,a)$ with $y_i< a$, such that
$$
\lim_{i\to\infty} h(z_i)= [z]\in S^1\times \mathbb R.
$$
Proof. Suppose this is not the case. Then there exists a neighborhood $U$ of $z$ in $[0,1]\times (t_1, a]$ and
a neighborhood $V$ of $[z]$ in $S^1\times \mathbb R$
such that
$$
h(U\cap T)\cap V=\emptyset.
$$
However, there exists a rational number $t_1 < r< a$ such that $(0, r)\in U$ and $h(0,r)=[(0,r)]\in V$. By continuity of $h$ restricted to the interval $[0,1]\times \{r\}$,
$$
\lim_{x\to 0+} h(x,r)=[(0,r)]\in V.
$$
Thus, we find $(x,r)\in U\cap T$ such that $h(x,r)\in V$. A contradiction. qed
Consider the equivalence relation $\sim$ on $\mathbb R$ given by $x\sim x'$ iff $x=x'$ or $x, x'\in \mathbb Z$. Define the equivalence relation $\approx$ on $X=\mathbb R\times \mathbb Q$ as the product equivalence relation:
$$
(x,y)\approx (x',y')\iff x\sim x', y=y'.
$$
We get the quotient map $p: \mathbb R\to Y$ for $\sim$, the product space $W=Y\times \mathbb Q$ and the quotient map
$q: X\to Z=X/\approx$. Clearly, the projection $\pi_W: W\to \mathbb Q$ is an open map.
Lemma 3. The projection $\pi: X\to \mathbb Q$ descends to a continuous open map $\pi_Z: Z\to \mathbb Q$.
Proof. The projection $\pi$ is constant on each equivalence class of $\approx$, hence, it descends to a continuous map $\pi_Z: Z\to \mathbb Q$. To check that $\pi_Z$ is open, take an open subset $U\subset Z$. Then $q^{-1}(U)$ is an open $q$-saturated subset of $X$. Since $\pi$ is an open map, $\pi(q^{-1}(U))$ is open in $\mathbb Q$. We have
$$
\pi(q^{-1}(U))= \pi_Z(q(q^{-1}(U)))= \pi_Z(U).
$$
Hence, $\pi_Z(U)$ is open in $\mathbb Q$. qed
Let's identify connected components of $Z$ and $W$. For each $r\in \mathbb Q$ define $W_r:=Y\times \{r\}$. Is is clearly connected and is a fiber of $\pi_W$. Similarly, each $Z_r=\pi_Z^{-1}(r)$ is also connected (it equals the projection to $Z$ of a horizontal line in $X$). Since $\mathbb Q$ is totally disconnected, all components of $Z$ and $W$ are of the form $W_r, Z_r$, $r\in \mathbb Q$. Each $Z_r, W_r$ is a union of circles meeting at a single point. These circles are, respectively, the images $C_{rn}, D_{rn}$ of the intervals $[n, n+1]\times \{r\}, n\in \mathbb N, r\in \mathbb Q$, under the maps $q: X\to Z$ and $p\times id: X\to W$. The space $W_r$ is homeomorphic to $Y$ which is the countable wedge of circles. One can prove that the same is true for each $Z_r$. But we will only need the fact that $Z_r$ contains precisely one cut-point $z_r$
(i.e. a point whose removal disconnects the space $Z_r$), namely, the projection of $(0,r)\in X$ to $Z$. Similarly, $W_r$ has unique cut-point $w_r$, the image of $(0,r)\in X$ in $W$.
Theorem. The spaces $Z$ and $W$ are not homeomorphic.
Proof. Recall that the connected components in $Z$ and $W$ are: In $W$ these are subsets $W_r:=Y\times \{r\}$, $r\in \mathbb Q$ (i.e. the fibers of $\pi_W$), while in $Z$ these are the fibers $Z_s=\pi_Z^{-1}(s)$ of the map $\pi_Z$. Therefore, every homeomorphism $h': Z\to W$ would have to send each $Z_r$ to some $W_s$, inducing a bijection $\beta: \mathbb Q\to \mathbb Q$, $r\mapsto s$.
Lemma 4. The bijection $\beta$ is a homeomorphism.
Proof. This follows from Lemma 3 since both $\pi_W, \pi_Z$ are quotient maps and $h'$ is a homeomorphism:
$$\require{AMScd}
\begin{CD}
Z @>{h'}>> W\\
@VV{\pi_Z}V @VV{\pi_W}V \\
{\mathbb Q} @>{\beta}>> {\mathbb Q}
\end{CD}$$
qed
We now postcompose the homeomorphism $h': Z\to W$ as above with the homeomorphism $id\times \beta^{-1}: W\to W$. The result is a homeomorphism $h$ which induces the identity map $\mathbb Q\to \mathbb Q$ as it sends each component $Z_t$ to $W_t$, $t\in \mathbb Q$. Let $h_t: Z_t\to W_t$ denote the restrictions (these are again homeomorphisms). Hence, each $h_t$ sends cut-points to cut-points, $h(z_t)=w_t$. Of course, it does not follow that $h_t$ sends $C_{tn}$ to $D_{tn}$ for general $t$ and $n$. However, $h_t$ induces a collection of homeomorphisms
$$
C_{tm}\to D_{tn}, n=\alpha_t(m),
$$
where $\alpha_t: \mathbb Z \to \mathbb Z$ is a bijection. It will be convenient to modify $h$ one more time so that at least $\alpha_0$ is the identity map.
Lemma 5. Given a bijection $\alpha: \mathbb Z \to \mathbb Z$, there is a homeomorphism
$$
\psi: W_0=Y\to W_0=Y
$$
sending each circle $D_{0n}$ to $D_{0\alpha(n)}$.
Proof. Define a (typically discontinuous) map
$$
\Psi: \mathbb R\to \mathbb R, \Psi|_{[n,n+1)}(x)= x- n+ \alpha(n), n\in \mathbb Z.
$$
This map restricts to a homeomorphism on the complement to the set of integers in $\mathbb R$. The map $\Psi$ descends to a self-map
$\psi: Y\to Y$. I will leave it to you to check that $\psi$ is the required homeomorphism. qed
Now, take the postcomposition of the homeomorphism $h: Z\to W$ with the homeomorphism
$$
\psi^{-1}\times id.
$$
I will denote this map again by $h$. This homeomorphism has the property that it sends each circle $C_{0n}$ to the circle $D_{0n}$. For the new map I will keep the notation $h_t$ and $\alpha_{tn}$ introduced above.
Let $\Sigma_n$ denote the projection of $[n,n+1]\times \mathbb Q$ to $Z$. Since $\alpha_0=id$, continuity of $h$ restricted to $\Sigma_n$ implies:
Lemma 6. For each $n$ there exists $\epsilon_n>0$ such that for all $t\in (-\epsilon_n, \epsilon_n)\cap \mathbb Q$, $\alpha_{t}(n)=n$.
Since $q$ is a quotient map and $h$ is a homeomorphism, the composition $h\circ q: X\to W$ is a quotient map. We will argue by contradiction similarly to the proof given in
Brown, Ronald, Topology and groupoids, Bangor: Ronald Brown (ISBN 1-4196-2722-8/pbk). xxiv, 512 p. (2006). ZBL1093.55001.,
p.111 (the reference is from the linked answer by Brown).
Namely, we will find an $h\circ q$-saturated closed subset $A$ of $X$ whose image in $W$ is not closed. This would contradict the fact that $h\circ q$ is a quotient map.
We pick a strictly decreasing sequence of positive irrational numbers $b_n$ converging to zero such that $b_n<\epsilon_n$ for all $n\in \mathbb N$. For each $n$ we have the continuous map $h\circ q: [n, n+1]\times ((-\epsilon_n, \epsilon_n)\cap\mathbb{Q})\to D_n\times \mathbb{Q}$ where $D_n = p([n, n+1])\subseteq Y$ is a circle. By applying Lemma 2 to this map, we find a sequence $(a_{ni})_{i\in \mathbb N}$ in
$(n, n+1)\times ((0, b_n)\cap \mathbb Q)$ converging to $(n, b_n)$ such that $\lim_{i\to\infty} (h\circ q)(a_{ni}) = [(n, b_n)]$. The subset
$$
A:= \{ a_{ni}: (n, i)\in \mathbb N \times \mathbb N\}\subset X
$$
is closed in $X$ (since each $b_n$ is irrational) and is $q$-saturated (since $q$ is 1-1 on $A$). Hence, it is also $h\circ q$-saturated. We will see that $B=h\circ q(A)$ is not closed in $W$, more precisely, it accumulates to the cut-point $w_0\in W_0$ which is clearly not an element of $B$ (since $A$ is disjoint from $\mathbb R\times \{0\}$).
Lemma 7. The point $w_0$ lies in the closure of $B$ in $W$.
Proof. Consider a product neighborhood $U\times (-\delta, \delta)$ of $w_0$ in $W$, where $U$ is a neighborhood of $w_0$ in $W_0$ (which we identify with $Y$, as before). Set $U_n:= D_{n}\cap U$, it is a neighborhood of the equivalence class of $n$ in the circle
$$
S^1=D_n=[n,n+1]/\{n, n+1\}.
$$
Fix $n$ such that $b_n< \delta$ and consider the restriction of $h\circ q$ to
$$[n,n+1]\times ((-\epsilon_n, \epsilon_n)\cap\mathbb{Q}).$$
By the choice of the sequence $(a_{ni})$ in Lemma 2 we have
$$
\lim_{i\to\infty} (h\circ q)(a_{ni})= [(n, b_n)]\in S^1\times \mathbb R.
$$
Therefore, for all sufficiently large $i$ the first coordinate of $(h\circ q)(a_{ni})$ lies in $U_n$. The second coordinate, of course, lies in the interval
$(0, b_n)\cap \mathbb Q$, hence, is positive and less than $\delta$. Thus, $(h\circ q)(a_{ni})$ belongs to $U\times (-\delta, \delta)$. Lemma follows. qed
Thus, we proved that $h\circ q$ is not a quotient map. This contradiction proves that a homeomorphism $h$ does not exist, concluding the proof of the theorem. qed