Here is a sketch of the proof you'll need. I'm assuming it was an odd prime you're looking for, as 2 does not work, thus:

Let p be an odd prime not equal to 5. Then p is either congruent to 1, 3, 7, or 9 modulo 10. squaring any of these numbers we see that they are congruent to either 1 or 9 modulo 10, so if we add 1 or subtract 1, respectively, they are congruent to 0 modulo 10, thus divisible by 10.

Hope that helps.