Prior and earlier can both be used in many cases, but not all.
"I ate breakfast earlier." = "I ate breakfast earlier than now."
"I ate breakfast early."= I ate breakfast at an early time.
"I ate breakfast prior to starting out." - Note that prior needed some event to compare with it.
Also, placement is different.
I could say:
"Prior to my graduation, I got married." It could also be the reverse order.
I would say:
"I got married earlier than my graduation." (Actually, you would seldom hear it put this way - more likely - "I got married before I graduated."