Showing that $p^2 \not\equiv 1\pmod{q}$ given some conditions

For the first congruence, this can hold only if $p \equiv \pm 1 \bmod q$. But this can’t happen for primes $p<q$ unless $p=2$ and $q=3$.

For the second congruence it shows that $p$ has order dividing $3$ in the group of invertible elements mod $q$ which is a group of order $q-1$. By Lagrange and the assumption on $q$ this implies the order is one and this once again contradicts the fact that $q$ is bigger than $p$.