What a great question! These two words often are used interchangably, but they do mean different things. Confusion arises because the two words are related in meaning. They both reflect some truth about life.
An aphorism is a short, witty statement that usually reflects some truth about life. "The darkest hour comes before the dawn" is literally true. However, metaphorically speaking, it is a statement of hope. Just when it looks like all is lost, dawn appears. There is hope, a change in direction, and light. Aphorisms are similar to proverbs.
An epigram is a short poem that also expresses some truth, but it might have a sarcastic or humorous tone. Epigrams are short because originally they were engraves on tombstones. The usage has evolved, however, to include short poetic passages that end with some kind of twist.
Life’s saving graces are love, pleasure, laughter ...
wisdom, it seems, is for the Hereafter.
—Michael R. Burch
Shakespeare, Alexander Pope, and John Donne were masters of the epigram.
Blessed is he who expects nothing, for he shall never be disappointed. (Alexander Pope)
As you travel the Internet, be careful. Many sites confuse aphorisms and epigrams.