WASHINGTON — The Senate on Wednesday afternoon passed a $4.6 billion emergency funding bill to provide humanitarian aid to the thousands of migrants seeking asylum on the southern border, but the measure’s path to the president’s desk is far from certain.

The measure, which passed with overwhelming and bipartisan support in a 84-8 vote, must now be reconciled with the House measure that passed Tuesday and was voted down by the Senate earlier Wednesday, before it can be sent to President Donald Trump for his signature.

With Congress hoping to pass a funding bill before they leave town for the July Fourth recess, time is of the essence for the House and the Senate to come to an agreement, as overcrowded conditions on the border worsen for migrants and the federal agencies that care for them run out of money.

Speaker Nancy Pelosi called the president on Wednesday afternoon in an attempt to work out the differences between the House and Senate bill. The 15-minute call took place just moments before the president left for Osaka, Japan, for the G-20 conference.

"We're doing very well. It's very far along, and I believe the House is going to also be getting together with the Senate," Trump said on the South Lawn after the call. "Hopefully they can get something done."

The strong bipartisan Senate vote was a rare moment of comity in Congress on the issue of immigration, which has divided the parties for decades. But the drastic need of assistance for federal agencies, nonprofits and nongovernment organizations working with migrants on the border led members of both parties to put aside the more contentious components of immigration and address the crisis at hand. None of the seven senators seeking the Democratic nomination for president were on hand for the vote because of the debate starting Wednesday night in Miami.

The measure doesn’t change immigration law or policy. It does not provide money to fund the president’s border wall and it doesn’t provide funds to increase the number of immigrants in detention, which are items unacceptable to Democrats.

In contrast, the House bill passed with just three Republican votes.

While both measures provide funding for the Department of Health and Human Services and the Department of Homeland Security to provide services for children and families, the House provides more stringent and specific guidelines for humanitarian standards. It also allows for unannounced visits by members of Congress with oversight and mandates that "influx" centers comply with humanitarian standards within six months instead of 14 months, the time limit in the Senate bill.

House Democratic leaders made two rounds of changes to their bill to garner the support of many progressive and Hispanic Caucus members. The House version of the legislation failed in the GOP-controlled Senate on Wednesday in a 37-55 vote, forcing the two bodies to reconcile the two bills.

CORRECTION (Wednesday, June 26, 2019, 4:38 p.m.): An earlier version of this article misstated a key part of the Senate appropriations bill. The bill does not provide any funding for Trump's proposed border wall.