with a little rearranging you have:
(p^4-8p+3p^3-24)/(p^3-9p-2p^2+18) now upon factoring...
(p(p^3-8)+3(p^3-8))/(p(p^2-9)-2(p^2-9)) which is equal to:
((p+3)(p^3-8))/((p-2)(p^2-9)) now more factoring...
((p+3)(p-2)(p^2+2p+4))/((p-2)(p+3)(p-3)) let the (p+3)s and (p-2)s cancel
(p^2+2p+4)/(p-3) that is as far as you are going to simplify unless you want to find imaginary factors for the numerator...