If you qualify, upon departure, you may ask the U.S. Citizenship and Immigration Services (USCIS) for provisional unlawful presence waivers while residing in Mexico. This waiver lets you apply for a green card once outside the U.S. without returning to Mexico.
For more information, please visit the USCIS website.