They are synonyms. English has very few true synonyms, but those two words really do have exactly the same meaning and are used in the same way.
Apparently, 'perhaps' is more common in written English and 'maybe' is more common in spoken English. 'Perhaps' could also be considered as slightly more formal, but there really isn't much difference. You can use either one in any situation.