With the House in chaos over its spending plans, senators of both parties were deep in negotiations on Monday over efforts to head off a government shutdown this weekend through a stopgap measure and whether to include additional aid to Ukraine in the legislation.

Senators and senior staff members engaged in intense discussions over the past few days on how to proceed given the House impasse, officials said, with the Senate taking steps toward an emergency spending bill that would keep dollars flowing to federal agencies after the current fiscal year ends at midnight Saturday.

People familiar with the talks said a major sticking point was whether to add up to $25 billion in new assistance to Ukraine to what is formally known as a continuing resolution or to keep the legislation free of contentious provisions in what would be a “clean” measure that might enjoy broader support among Republicans in the House, which would also have to pass it to keep the government open.

Despite broad bipartisan support in the Senate for money for Ukraine, officials said, some Republicans were arguing that it would present an added complication in trying to provide Speaker Kevin McCarthy with a way out of the spending logjam. A significant bloc of House Republicans opposes any more Ukraine funding and would most likely insist that it be stripped out of the bill and returned to the Senate, slowing any resolution when there is little time to spare.

On Monday, Representative Marjorie Taylor Greene, Republican of Georgia and a close adviser to Mr. McCarthy on the political appetites of the party’s base, warned her colleagues against taking up a separate Pentagon spending bill. She said that even a procedural vote to advance that legislation was tantamount to “a vote for BILLIONS in new blood money for the proxy war in Ukraine.”

“How many Republicans will vote to give Biden a blank check to fund his proxy war with Russia in Ukraine?” Ms. Greene wrote on X, the social media platform formerly known as Twitter.

Congress has approved about $113 billion in military, humanitarian and economic aid to Ukraine in four packages since the invasion by Russia, and President Biden has been seeking another $24 billion.

But a coalition of senators is pressing for the money for Ukraine to be included in the temporary spending measure. They have argued that it would be a grave mistake to fail to show support for Ukraine, particularly after President Volodymyr Zelensky met personally with members of the Senate during a visit last week and received assurances of continued backing.

“He answered questions for an hour about support from other allies and partners, transparency and accountability about the aid, how he sees the war ending and what he thinks will happen if we don’t support Ukraine,” said Senator Chris Coons, Democrat of Delaware. “I think for us in the Senate, having offered our broad and strong support, to move ahead with appropriations without additional support for Ukraine sends exactly the wrong signal to our partners, our allies and our adversaries around the world.”

Senator Mitch McConnell, Republican of Kentucky and the minority leader, has been one of the staunchest backers of Ukraine on Capitol Hill and has also joined with Democrats to pursue higher government spending levels than House Republicans.

But he and other Republicans are also reluctant to put Mr. McCarthy in a difficult spot by pressing the Ukraine aid, an approach that could also give the speaker a ready reason to reject the Senate overture. Some lawmakers have said that they could still quickly pursue the Ukraine spending, aid for natural disaster recovery and some new border security provisions in separate legislation once Congress deals with the immediate crisis of the potential shutdown.

The divide over Ukraine among senators who almost universally back the aid illustrates the difficulties Congress will face this week as it tries to avert a shutdown. The Senate has been awaiting some spending action by the House before taking steps on its own, but with the House bogged down, the Senate is now preparing its own version of an interim spending bill to keep the government fully operational.

Even if the Senate is able to assemble and pass a temporary spending measure in the next few days, it is uncertain whether Mr. McCarthy would even bring the legislation to a vote. Doing so would be likely to provoke a formal challenge to his hold on the speakership, presenting him with a choice between keeping the government open or igniting a fight for his job.

When the House returns on Tuesday, lawmakers are expected to begin considering a series of individual spending bills for the coming fiscal year, though that debate will get the House no closer to sidestepping an imminent shutdown. What Mr. McCarthy and his allies hope is that by taking up the measures that contain steep spending cuts sought by conservatives, they can reduce resistance to quick passage of a stopgap bill to keep the government functioning for the next month or two.

At the moment, Mr. McCarthy does not have the support solely among the G.O.P. to move ahead with an interim bill because right-wing Republicans such as Representative Matt Gaetz of Florida insist the spending bills should be considered separately and say they will not back an interim measure.

“I want to fund the government; I’m not pro-shutdown,” Mr. Gaetz, who has become Mr. McCarthy’s chief antagonist, said on Fox News’s “Sunday Morning Futures.” “But the way to fund the government is not the same way we’ve been doing it since the mid-’90s where it’s one up-or-down vote on the entire government all at once.”

Mr. McCarthy will also have to contend with increasing calls from former President Donald J. Trump for Republicans to take a hard line in the spending negotiations.

“The Republicans lost big on Debt Ceiling, got NOTHING, and now are worried that they will be BLAMED for the Budget Shutdown,” Mr. Trump said in a post Sunday on his social media site, Truth Social.

“Wrong!!! Whoever is President will be blamed,” he wrote, adding, “UNLESS YOU GET EVERYTHING, SHUT IT DOWN!”