Those tweaks — and the addition of North Korea sanctions to a Senate package that included only Russia and Iran, months after the House approved sanctions against North Korea by a vote of 419 to 1 — helped end the impasse.

The House version of the bill was set for a vote on Tuesday, according to Mr. McCarthy’s office.

The agreement comes at a particularly uncomfortable moment for the White House. Sanctions are central to the mystery over Donald Trump Jr.’s meeting with a Russian lawyer and others on June 9, 2016, where he said the topic of adoption came up. That was a reference to Mr. Putin’s decision to ban American adoptions of Russian children in response to sanctions Congress passed over human rights issues.

The discussions that the president’s former national security adviser, Michael T. Flynn, held with the Russian ambassador to the United States during the transition were also said to be about sanctions, including President Barack Obama’s decision, in his last weeks in office, to evict Russia from two of its diplomatic compounds in the United States. Mr. Trump must soon decide whether to return them.

For months, lawmakers have agreed on the need to punish Russia, separating the issue from others, such as immigration and health care, that have been mired in partisan wheel-spinning. The unity has placed Republicans in the unusual position of undercutting their own president on a particularly awkward subject.

Yet politically, the collaboration delivers benefits to members of both parties. Democrats have sought to make Russia pay for its 2016 election interference, which many of them believe contributed to Mr. Trump’s triumph over Hillary Clinton. And Republicans, who have long placed an aggressive stance toward Russia at the center of their foreign policy, can quiet critics who have suggested they are shielding the president from scrutiny by failing to embrace the sanctions.

Senator Chuck Schumer of New York, the minority leader, said he expected this “strong” bill to reach the president’s desk promptly “on a broad bipartisan basis.”

In the House, Representative Steny H. Hoyer of Maryland, the minority whip, praised the agreement’s stipulation that “the majority and minority are able to exercise our oversight role over the administration’s implementation of sanctions.”