The statement is this: If $X,Y$ are closed subspaces of $Z$ and if $X\cap Y$ is a strong deformation retract of $Y$, then $X$ is a strong deformation retract of $X\cup Y$
Now, paraphrasing my proof goes like this;
Assume that $X,Y$ are closed etc, since $Y$ is SDR of $X\cap Y$ there exists a homotopy $H$ which takes $Y$ to $X\cap Y$. Using this, define $G$ to be the identity on $X$ and $H$ on $Y-X$. This function should be continuous since Id is continuous, $H$ is continuous and $H$ and Id agree on the boundary of $X$, so this $G$ is a SDR from $X\cup Y$ to $X$.
Now unless I'm missing something here (I probably am) where did the requirement that these sets be closed come in?
Here is a general gluing rule for continuous functions.
Let $X, Y$ be topological spaces and $f : X → Y$ a function. Let $X = A ∪ B$ where $A \setminus B ⊆ \text{Int } A$, $B \setminus A ⊆ \text{Int } B$. If $f | A$, $f | B$ are continuous, then $f$ is continuous.
I leave you to see the use of this for the result you are asking about.