How to prove that entropy is a state function? Consider the following steps:
\begin{align}
\mathrm{d}U &amp;= \mathrm{d}q - p\,\mathrm{d}V\\
\mathrm{d}U &amp;= C_V\,\mathrm{d}T\tag1\\
\end{align}
Side question: Is equation $(1)$ only true for a perfect gas or all substances?
\begin{align}
C_V\mathrm{d}T &amp;= \mathrm{d}q - p\,\mathrm{d}V\\
\mathrm{d}q &amp;= C_V\,\mathrm{d}T + p\,\mathrm{d}V\\
\end{align}
Divide by T:
$$\mathrm{d}S = \frac{C_V}{T}\,\mathrm{d}T + \frac pT\,\mathrm{d}V$$

The proof requires a substitution of $\frac pT=\frac{nR}V$ because when it is then differentiated with respect to $T$ it equates to zero and so does $\frac{C_V}{T}$ when it is differentiated with respect to $V$ which shows it is an exact differential. However, if you do not make the substitution you do not get zero so the two differentials do not equal each other. This would suggest that entropy is not a state function. Am I going wrong somewhere?
I don't understand what you mean by saying "if you don't make the substitution you do not get zero".  The relevant point is that, for ideal gases, $$p = nRT/V,$$ so $p/T$ is constant with respect to $T$.  Therefore $$\frac \partial{\partial T}\left(\frac pT\right)=0$$ for an ideal gas, whether or not you use the substitution to simplify the process.

If you don't use the substitution, you need to use the quotient rule to do the partial derivative properly, and you should still end up getting zero if you do it correctly.  Could that be where your confusion is coming from?