If $X$ is a stable curve, and $X_i$ a singular component, then a section $f \in H^0(X,\mathcal{O}_X(p))$ gives a section in the blow-up (constant on the new $\mathbb{P}^1$), so we can assume that $X$ is semi-stable with non-singular components, and no $\mathbb{P}^1$ intersects in only one point.
We have two cases to consider:
- If the component $X_i$ of $p$ has positive genus, then a global section $f$ can be restricted to $X_i$ where it gives the isomorphism to $\mathbb{P}^1$ as usual.
- If $X_i$ has genus zero, then it intersects the rest of the curve in at least two points $x_1$ and $x_2$. Since $f$ can be restricted to individual components, it must be constant on the rest of the curve, so we get $f(x_1)=f(x_2)$. Now $f-f(x_1)$ has two zeroes, and thus $f$ has more than a single pole on $X_i$, so we get a contradiction.
This also shows that the result does not hold on arbitrary semi-stable curves.