Senate Majority Leader Mitch McConnell (R-Ky.) arrives to speak to reporters following a luncheon at the Capitol on Tuesday. “House Democrats have been consistently uncooperative and uninterested in anything except political posturing,” he said. (J. Scott Applewhite/AP)

The crisis on the U.S.-Mexico border took on new urgency on Capitol Hill on Wednesday as lawmakers horrified by a photo of a father and his young daughter dead in the Rio Grande rushed to pass billions in emergency spending sought by the Trump administration.

The Senate overwhelmingly approved a $4.6 billion bill that would replenish the fast-dwindling budget of the agency responsible for the care of unaccompanied migrant children. But the legislation threatened to get hung up in disputes over a different version of the bill passed by the House with mostly Democratic votes, even as leaders in both chambers insisted they would not head home for Congress’s Fourth of July recess before sending a final bill to President Trump.

“The House will not leave until we resolve the situation at the border,” House Democratic Caucus Chairman Hakeem Jeffries (D-N.Y.) told reporters as he left an evening meeting with Speaker Nancy Pelosi (D-Calif.) and other leaders. “We’re looking forward to finding common ground with the Senate as well as with the president.”

Throughout the day Wednesday, as lawmakers discussed the border bill on the Senate floor and negotiated behind closed doors, debate was shadowed by the widely circulated photo of two migrants — Óscar Alberto Martínez Ramírez and his 23-month-old daughter, Valeria — who drowned trying to cross the river into Brownsville, Tex. In the photo, the pair lie face down in shallow water, the little girl’s arm around her father.

“President Trump, I want you to look at this photo,” said Minority Leader Charles E. Schumer (D-N.Y.), displaying it on the Senate floor. “These are not drug dealers. Or vagrants or criminals. They are simply people fleeing a horrible situation in their home country for a better life.”

Sen. Ron Johnson (R-Wis.), chairman of the Homeland Security Committee, opened a hearing on the migration crisis by declaring: “I don’t want to see another picture like that on this border.”

“I hope this picture will catalyze Congress to do something,” Johnson said. “We have to do something.”

And a normally gridlocked Congress did appear poised to act, although the legislation under consideration is a narrow funding bill that does not address broader changes to asylum laws or base causes of migration that lawmakers of both parties say are crucial. The legislation would, however, pour billions into the coffers of undermanned and overwhelmed agencies that have buckled under the burdens of nearly unprecedented levels of migration from Central America, resulting in children being housed in facilities that visitors have called inhumane while many more migrants are processed and released into the United States to await long-distant court dates.

Although bipartisan negotiations have also begun in the Senate and with Trump administration officials on broader changes to asylum laws, few hold out hope of a resolution before the deadline Trump set for beginning large-scale raids to round up unauthorized immigrants. The specter of those raids, which Trump announced Saturday he was delaying for two weeks at Democrats’ request, complicated negotiations on the border spending bill in the House, where many liberals are highly distrustful of Trump administration officials and sought provisions to tie their hands.

Trump blamed the migration crisis and deaths like the one depicted in the photo of Martínez and his daughter on Democrats’ failure to agree to “the right laws,” although Republicans in the past have also stood in the way of comprehensive changes to immigration laws. But Trump also sounded a note of optimism on getting the spending bill through Congress.

“You have to change the loopholes; you have to change asylum. You wouldn’t have this problem. They’re not working on that, unfortunately, today,” Trump told reporters outside the White House before departing for Japan. “What they’re working on is aid, humanitarian aid for the children. It seems that the Senate is very close. I think that Nancy wants to get something done, and the Senate and the House will get together. I think they’ll be able to do something very good.

The House and Senate bills allocate around the same amount of funding, but the House version contains a number of provisions aimed at limiting how the administration can spend it and denies money for the Pentagon and the Immigration and Customs Enforcement agency that’s included in the Senate bill. The House version also contains stricter requirements on use of intake facilities and who can be placed in them, and it puts requirements on funding for Central American nations not contained in the Senate bill.

The Senate bill passed Wednesday on an overwhelming bipartisan vote of 84-8, while the House version, which is opposed by the White House and by Senate Republicans, passed on a near party-line vote of 230-195.

Pelosi had to make a number of concessions to members of the Congressional Hispanic Caucus and the Congressional Progressive Caucus to gain support from lawmakers who are deeply opposed to the administration’s immigration policies. But Senate Republicans and the White House describe such provisions as non-starters that would prevent the House Democratic bill from ever becoming law, and they accused Democrats of playing politics with people’s lives.

“House Democrats have been consistently uncooperative and uninterested in anything except political posturing,” said Senate Majority Leader Mitch McConnell (R-Ky.). “Now that they’ve finally passed something last night, it’s a go-nowhere proposal filled with poison-pill riders which the president would veto.”

In a statement Wednesday night, Pelosi outlined a handful of changes House Democrats wanted to see in order to support the Senate-passed bill, including limiting the amount of time a child can spend in an influx facility to 90 days; requiring that the death of a child in a holding facility be reported within 24 hours; and ensuring that lawmakers can visit any facility without advance notice. House Democrats planned to meet Thursday morning to discuss how to move forward on the issue.

Lawmakers and administration officials have warned that without action by Congress, the Office of Refugee Resettlement, which is charged with the care of unaccompanied children, will run out of money at the end of this month. The agency, part of the Department of Health and Human Services, has already cut services such as English and soccer for children in its care, and conditions would become even more grim without an influx of money, officials say.

Through May, nearly 51,000 children had been referred to HHS since the beginning of the fiscal year in October, an increase of almost 60 percent over the comparable period last year, according to the Senate Appropriations Committee. The Senate bill includes $2.88 billion for the Office of Refugee Resettlement, as well as hundreds of millions of dollars to assist Customs and Border Protection with migrant care facilities, clothing, food and other needs.

Conditions at holding centers for children have been under increased scrutiny after lawyers who visited a facility in Clint, Tex., described disturbing scenes of sick and dirty children without basic necessities and in the care of other children. Earlier this week, Trump replaced his interim border chief in the latest leadership shake-up at the Department of Homeland Security.

The developments on Capitol Hill on Wednesday took place on the first of two days of back-to-back Democratic Party presidential debates, the first of the 2020 campaign, and some of the candidates gathering in Miami took the opportunity to visit nearby migrant shelters to highlight the conditions there.

Sen. Elizabeth Warren (D-Mass.) traveled to a shelter in Homestead, Fla., just 20 miles from the site of Wednesday’s debate to rally support for migrants, declaring: “We do not lock people up for political ends, which is what the president of the United States is doing here.” Warren was among seven Senate Democrats who are running for president and whose attendance at the debates caused them to miss Wednesday’s vote on the border spending bill.

Abigail Hauslohner, Rachael Bade, Paul Kane and Karoun Demirjian contributed to this report.