Because Republicans have said that they will use the $40 billion funding bill for the Department of Homeland Security as their vehicle for dismantling Mr. Obama’s action, Congress faces another deadline that seems likely to force an accommodation before the department’s money is due to run out at the end of February.

Yet, in just their second week of control on Capitol Hill, Republicans on Wednesday were forced to address questions about whether the party again would be hobbled by internal disagreements over immigration policy. And they were faced with an unwelcome distraction from their message of governing responsibly and cooperatively: explaining why the vote on Wednesday should not be seen as an insult to Hispanics, a constituency Republicans lost by more than two to one in the 2012 presidential election and have been trying to woo since.

In the House, 26 Republicans voted against an amendment to effectively undo Mr. Obama’s 2012 executive action that allowed immigrants who had entered the United States illegally as children to stay. The amendment just barely passed with 218 votes, a few more than it needed. No Democrats voted yes.

The overarching funding bill for Homeland Security passed, 236 to 191, with 10 Republican defections. Senator Mitch McConnell of Kentucky, the majority leader, was expected to meet with his members over the next few days to discuss how to move forward with the bill, including whether they could amend it, strip out some of its more contentious amendments and send it back to the House.

Republicans who supported the legislation said there was nothing cruel about their intentions. The debate was not about immigration, many of them insisted on Wednesday, but about a president who had exceeded his authority by rewriting immigration law without Congress’s consent.