What is the difference between an idiom and an aphorism?

An idiom employs figurative language to make a point (e.g., “It’s a piece of cake”). Idioms can be used in a variety of contexts.

An aphorism is a short phrase used to impart wisdom. Some aphorisms may use figurative language also. But this is not always the case (e.g., “You can’t always get what you want”).