There are some results for special cases. Burnside has proved in $1912$ that, if $G$ is a non-metabelian $p$-group, then the centre of the derived group of $G$ cannot be cyclic. In particular, a non-Abelian group of order $p^3$ cannot be the derived group of a $p$-group. Blackburn later desribeddescribed the 2-generator groups that arise as commutator subgroups of $2$-generator $p$-groups, see here.