A phrase is “a small group of words standing together as a conceptual unit”, while an idiom is “a group of words established by usage as having a meaning not deducible from those of the individual words”. So, the difference is that an idiom as an established meaning not directly linked to the individual words. Any idiom is a phrase.