p will be odd. therefore p^{2}will be odd. therefore p^{2}-1 will be even.

the greatest divisor will be p^{2}-1 itself. the next largest divisor will be (p^{2}-1)/2.

(in your example p = 5. so p^{2}- 1 = 24. 24 is a divisor of 24. but, if you only want "proper divisors", the next largest divisor is 12).