Changing 2nd order homogeneous differential equation to the one with constant coefficients
When we change variables from $x$ to $z(x)$ what we're doing is effectively looking for a function $z$ that shifts $y$ and its derivatives so that $p(x)$ and $q(x)$ are fixed relative to them, allowing us to consider $p$ and $q$ as constants in this new variable.
By the chain rule, \begin{equation} \frac{\mathrm d}{\mathrm{d}x} y(z(x)) = \frac{\mathrm d}{\mathrm{d}z} y(z) \frac{\mathrm{d}z}{\mathrm{d}x} \end{equation} and \begin{equation} \frac{\mathrm d}{\mathrm{d}x} (\frac{\mathrm d}{\mathrm{d}z} y(z) \frac{\mathrm{d}z}{\mathrm{d}x}) = \frac{\mathrm{d}^2}{\mathrm{d}z^2} y(z) (\frac{\mathrm{d}z}{\mathrm{d}x})^2 +\frac{\mathrm d}{\mathrm{d}z} y(z) \frac{\mathrm{d}^2 z}{\mathrm{d}x^2} \end{equation}.
Substituting into the original equation and rearranging, we get
\begin{equation} y''(z) +y'(z)(\frac{z''(x) +p(x)z'(x)}{(z'(x))^2}) + \frac{q(x)}{(z'(x))^2} y(z) = 0 \end{equation}
And so for the new coefficients to be constant, we require $\frac{z''(x) +p(x)z'(x)}{(z'(x))^2}= A_1$ and $\frac{q(x)}{(z'(x))^2} = \frac{1}{A_2}$ where $A_1,A_2$ are constants.
the second of these is easier to solve, giving us $z'(x) = \sqrt{A_2q(x)}$, which we can differentiate to give \begin{equation}z''(x) = \frac{1}{2}\frac{A_2}{\sqrt{A_2 q(x)}} q'(x) \end{equation} We can then plug this into the equation for the other coefficient and solve for $z$, \begin{equation} \frac{\frac{1}{2}\frac{A_2}{\sqrt{A_2 q(x)}} q'(x) +p(x)\sqrt{A_2 q(x)}}{A_2 q(x)} = A_1 \end{equation} Multiplying the top and bottom of the LHS by $\sqrt{A_2 q(x)}$ and rearranging gives us \begin{equation} \frac{q'(x) + 2p(x)q(x)}{q(x)^\frac{3}{2}} = 2\sqrt{A_2}A_1 \end{equation} and so the desired expression is clearly constant.
In the question nothing about the domain. It becomes problematic when $q^{3/2}$ appears. What can we say if $q<0$ and everything is real? Using the calculations of Baron we can write $$ \begin{align} A_2q &=(z')^2, \\ A_2q'&=2z'z'',\\ z''&=\frac{A_2q'}{2z'}. \end{align}$$ Substituting back we obtain $$ \frac{A_2q'+2p(z')^2}{2(z')^3}=A_1. $$ Since $(z')^2=A_2q$, from the last formula we have $$ A_2(q'+2pq)=2A_1(z')^3. $$ Squaring both side and using again the expression for $(z')^2$ we arrive at $$ \frac{(q'+2pq)^2}{q^3}=4A_1^2A_2. $$