Cracks in the House Democratic caucus showed Tuesday as the chamber passed the Senate's version of an emergency border aid bill.

The House approved the $4.6 billion Senate legislation Thursday following pressure from centrist members to take up the plan. It got through the House by a 305-102 margin and will head to President Donald Trump's desk. Among Democrats, 129 members voted for the legislation, while 95 opposed it.

The Democratic Party's liberal House members had insisted on including conditions for how the Trump administration treats children at detention centers as part of a separate bill it passed to fund the U.S. response to an influx of migrants at the southern border.

Congress is rushing to send money to the border before it leaves for its July 4 recess. The congressional spat over funding comes as Democrats criticize Trump for reports of dismal conditions for children detained at a U.S. facility in Texas. Pelosi said earlier that the House would "reluctantly pass" the Senate-approved bill.

"The children come first," Pelosi wrote in a letter to Democratic members Thursday. "Therefore, we will not engage in the same disrespectful behavior that the Senate did in ignoring our priorities. In order to get resources to the children fastest, we will reluctantly pass the Senate bill."

Democrats have nearly uniformly slammed Trump's treatment of migrant children. Leaders have tried to stave off his threats to start mass deportations two weeks from Sunday if Congress does not pass changes to asylum laws.

In a tweet Thursday, Trump said Congress did a "great job" in passing the legislation. He wrote that Washington now "must work to get rid of the Loopholes and fix Asylum" laws.

Trump tweet: Bipartisan Humanitarian Aid Bill for the Southern Border just passed. A great job done by all! Now we must work to get rid of the Loopholes and fix Asylum. Thank you also to Mexico for the work being done on helping with Illegal Immigration - a very big difference!

But some fissures have emerged among Democrats over how much to constrict how Trump can spend money sent to border operations.

In a tweet Thursday, Congressional Progressive Caucus co-Chairman Rep. Mark Pocan, D-Wis., eviscerated the Problem Solvers Caucus, the centrist group that pushed for Pelosi to adopt the Senate plan. Earlier, the 46-member caucus asked for "immediate consideration" of the Senate bill "given the humanitarian crisis at the border."

"Since when did the Problem Solvers Caucus become the Child Abuse Caucus?" Pocan asked. "Wouldn't they want to at least fight against contractors who run deplorable facilities? Kids are the only ones who could lose today."

Mark Pocan tweet: Since when did the Problem Solvers Caucus become the Child Abuse Caucus? Wouldn't they want to at least fight against contractors who run deplorable facilities? Kids are the only ones who could lose today.

Will Reinert, a spokesman for Problem Solvers Caucus co-chairman Rep. Tom Reed, R-N.Y., responded by saying Congress would have gone into next week without passing humanitarian aid without the group's effort. He also pointed to reports about the White House making efforts to address Democratic concerns.

In a meeting with Pelosi earlier Thursday, Vice President Mike Pence agreed to notify Congress within 24 hours when a child dies in U.S. custody, according to multiple reports. He also agreed that children would not spend more than 90 days in migrant influx facilities. It is unclear what mechanisms the lawmakers would put in place to enforce the agreements.

The plan Pelosi will take up Thursday caused less tension in the Senate when it passed Wednesday. Senate Minority Leader Chuck Schumer, D-N.Y., voted for it as the chamber approved it by an 84-8 margin. Six Democrats voted against it.

The plan gives money to the Departments of Homeland Security and Health and Human Services to care for migrants at the southern border.

Furor over Trump administration policy grew after an Associated Press report depicted malnutrition and poor sanitary conditions for children at a detention facility in Texas.

Rep. Alexandria Ocasio-Cortez, a New York Democrat and one of four Democrats who opposed the House-passed plan, tweeted Thursday that "they will keep hurting kids" if the House passes the Senate bill.

Ocasio-Cortez tweet: Under no circumstances should the House vote for a McConnell-only bill w/ no negotiation with Democrats. Hell no. That's an abdication of power we should refuse to accept. They will keep hurting kids if we do.

Subscribe to CNBC on YouTube.