Let $U \subset [0,2]$ be open. Let $x \in p^{-1}(U)$ be any point. Since $U$ is open in $[0,2]$, there exists $r>0$ such that $B_r(p(x)) \subset U$. Thus, $B_r(x) \subset p^{-1}(U)$ (If you really want, this can be proven more rigorously by sending $B_r(x)$ through $p$ and showing the image is a subset of $U$). Hence, $p$ is continuous.

To show that it is closed, let $F \subset [0,1]\cup [2,3]$ be a closed set. Let $y \in [0,2]\setminus \left(p(F)\cup \{1\}\right)$ (I am excluding 1 to avoid multiple preimages, as that is the only point with multiple preimages. I will handle that case next). Since $F$ is closed in $[0,1]\cup [2,3]$, there exists $r_0>0$ such that $B_r(p^{-1}(y)) \subset [0,1]\cup [2,3] \setminus F$. Let $r = \min\left\{r_0,\dfrac{|1-y|}{2}\right\}$. Thus, $B_r(y) \subset [0,2]\setminus p(F)$. (Again, if you really want, you can send $B_r(p^{-1}(y))$ through $p$ and show that you get $B_r(y)$).

If $1 \in [0,2]\setminus p(F)$, then you need to handle that separately. Since $p^{-1}(1) = \{1,2\}$, you need to find two radii. Choose $r_1>0$ such that $B_{r_1}(1) \subset [0,1]\cup [2,3] \setminus F$ and choose $r_2>0$ such that $B_{r_2}(2) \subset [0,1]\cup [2,3]\setminus F$. Let $r = \min\{r_1,r_2\}$. Now, $B_r(y) \subset [0,2]\setminus p(F)$. (To show this more rigorously, you should send $B_r(1) \cup B_r(2)$ through $p$ to show you get $B_r(y)$).

This shows $[0,2] \setminus p(F)$ is open, so $p(F)$ is closed.