(WASHINGTON) — The House voted to pass a sweeping border security and immigration bill on Thursday evening, just hours before the Trump-era immigration order– Title 42– expires at midnight.

The sweeping border security and immigration bill passed by a vote of 219-213. Two Republicans, Reps. Thomas Massie of Kentucky and John Duarte of California, joined all Democrats in voting against the legislation.

The bill will likely die in the Democrat-controlled Senate, and the White House has issued a veto threat.

The legislation, which House Speaker Kevin McCarthy called the “strongest border security bill to come through Congress in more than 100 years,” would increase penalties for individuals who overstay their visas and bolster the number of Border Patrol agents.

H.R. 2, known as the “Secure the Border Act,” also restarts border wall construction and reinstates the “remain in Mexico” policy that required some asylum-seekers to be sent back to Mexico during immigration proceedings.

“If it passes, I am confident that we will stop the flood of fentanyl into our country, solve the Biden Border Crisis, and support our border patrol agents so they can continue to keep us safe,” McCarthy said on the House floor prior to the vote.

Republicans are scrambling to strengthen immigration policy ahead of the end of Title 42. The Trump-era policy, which allowed for border agents to expel upward of two million migrants from the border during the COVID-19 pandemic, is set to lift at 11:59 pm after months of complicated legal and political battles. Democrats argue the bill is “extreme” and does not increase border security.

“This extreme MAGA Republican piece of legislation will throw out your children who are fleeing, in many cases, extreme violence and persecution. They will build a medieval border wall… The child deportation act is not a serious effort to deal with the issue related to our broken immigration system.,” Leader Hakeem Jeffries said at a press conference Thursday.

The White House said the bill does not address “the root causes of migration” and “does very little to actually increase border security while doing a great deal to trample on the nation’s core values and international obligations, it should be rejected.”

The Biden administration has instead revealed a sweeping version of border restrictions that it said would “humanely manage the border” when Title 42 lifts.

Under the finalized policy, migrants will be required to either first apply for protection in a third country or apply for admission via the CBP One App while also presenting at a legitimate port of entry to be considered, according to one Biden administration official.

The vote on the House proposal comes after months of negotiations within the GOP conference to hash out policy differences. On Wednesday, House members and leaders met behind closed doors for hours, making last-minute significant changes to the 213-page bill in an effort to secure enough votes for passage. The bill joins proposals from the House Judiciary, Foreign Affairs and Homeland Security committees.

When Title 42 expires at 11:59 p.m. ET Thursday, officials will immediately return to processing under existing Title 8 guidelines. Title 42 has been used more than 2.8 million times to expel migrants since its implementation in March 2020.

ABC News’ Isabella Murray and Katherine Faulders contributed to this report.

Copyright © 2023, ABC Audio. All rights reserved.