I am trying to find for what values of p $\frac{p^2-1}{8}$ will be even number $\frac{p^2-1}{8}=2m\implies (p-1)(p+1)=8(2m)$ then can I write $p\equiv 1\pmod8$ or $p\equiv -1\pmod8$ ?
Also trying to find for what values of p it will be an odd number
$\frac{p^2-1}{8}=(2m+1)\\\implies (p-1)(p+1)=8(2m+1)$$\text{ will it be } p\equiv 1\pmod8$ or $p\equiv -1\pmod8$ again? p is an odd prime
I think you want to look at congruences modulo $16$, not $8$. After all, $\frac{p^2-1}8=2m$ if and only if $p^2-1=16m$, that is $p^2\equiv1\pmod{16}$. Similarly $\frac{p^2-1}8$ is odd if and only if $p^2-1=8+16m$, that is $p^2\equiv9\pmod{16}$.
By writing down all eight possibilities, you see that $n^2\equiv1\pmod{16}$ if and only if $n$ is congruent to one of $1,7,9,15$ modulo $16$. The other four possibilities, $n=3,5,11,13$ square to numbers $\equiv9\pmod{16}$. And I think that’s the whole story.