Here is the standard proof for proving that $\sqrt{p}$, where $p$ is prime, is irrational.
Assume $\sqrt{p}$ is rational, so that $\sqrt{p} = \frac{a}{b}$, where $a, b \in \mathbb{Z}$, $b \neq 0$ and hcf$(a, b) = 1$
Then $a^2 = pb^2$, so $a^2$ is divisible by $p$. Therefore $a$ is divisible by $p$.
Then $a = pk$, where $k \in \mathbb{Z}$.
From earlier, $b^2 = pk^2$, so $b^2$ is divisible by $p$. Therefore $b$ is divisible by $p$.
The fact that $a$ and $b$ are both divisible by $p$ contradicts that hcf$(a, b) = 1$. Therefore, $\sqrt{p}$ is irrational.
In the proof, where do we use that $p$ is prime?
I think it is in deducing that $a$ is divisible by $p$ from $a^2$ divisible by $p$.
But then again, we have that $a^2 = pk$, and therefore $a \times a = p \times k$ and so if I divide both sides by $p$, it must divide one of $a$ or $a$. So maybe that's not where we use it.
Well, from $a\times a=p\times k$ you cannot deduce that $p|a$ for any general number. For instance, $4\times 4=8\times 2$ but $8$ does not divide $4$.