When a semiconductor diode is formed, a depletion layer is formed across its junction. This depletion layer has negative charge in p-type crystal and positive charge in n-type crystal, thus acts as a potential barrier for charge carriers.
In p-region, holes are majority carriers (electrons are minority carriers) and in n- region electrons are majority carriers (holes are minority carriers). When an electron (majority carrier) from nregion, tries to cross the junction, the negative charge of the barrier (in p-region) opposes the electron (whereas helps the hole) and electron is stopped by this barrier's negative plate. Same happens with a hole in p-region. Hence, the potential barrier offers opposition to majority carriers in both regions.