That touched off a behind-the-scenes round of haggling in which lawmakers had to reconcile the House bill with a far less confrontational version passed in the Republican-controlled Senate. Determined to meet the year-end deadline for renewing the legislation and demonstrate their party could legislate on issues of national security even as they pursue the president’s removal, Democratic negotiators conceded on a series of hot-button issues.

“This is exactly what the American people have been demanding of government, that we can actually move forward on legislating, on governing, to show that we are adults that are able to get things done on issues of national security,” said Representative Andy Kim, a freshman Democrat who represents a New Jersey district that voted for Mr. Trump in 2016. “Even in a time of divided government.”

The Senate is expected to take up the compromise bill and send it to the president’s desk as early as next week.

But the compromise left some liberal Democrats seething.

While it does not authorize any money to replenish military construction funds Mr. Trump diverted to pay for his wall on the southern border, it also does not contain a measure backed by Democrats to prevent him from raiding the fund in the future. Stronger language that would have forced the cleanup of a dangerous class of chemicals, known as PFAS, was dropped. And the final version jettisoned several other provisions passed by House Democrats: to ban new detainees from being placed at the military detention facility at Guantánamo Bay, Cuba; to prohibit the sale of certain types of munitions to Saudi Arabia; and to require Mr. Trump to seek congressional approval before taking any military action against Iran.

Representative Ilhan Omar, Democrat of Minnesota, said in a statement that she would not support the bill even though it contained some amendments she sponsored. “This bill commits the U.S. to endless involvement in the Saudi-led war in Yemen, continues funding for endless war” under a 2001 military authorization and “does nothing to prevent the administration from launching a disastrous war with Iran,” she said.