$p$ can be any polynomial and the matrices are square matrices
Now I know that by the Cayley–Hamilton theorem any matrice A satisfies it's characteristic polynomial and I feel that the key to the proof lies there, but not sure how to capitalize on it.
My guess is since $A$ and $B$ are similar they have the same $p(\lambda)$ so doesn't that imply (by what was stated earlier) that the matrices $p(A)$ and $p(B)$ are similar?