WASHINGTON — As Senate Republicans on Thursday defended their refusal to consider any Supreme Court nomination put forward by President Obama, Senator Lindsey Graham of South Carolina warned that both parties would pay the price, leading to the selection of judges with increasingly partisan views.

Mr. Graham, during a hearing of the Senate Judiciary Committee, said Republicans were justified in blocking Mr. Obama’s choice to fill a vacancy created by the death of Justice Antonin Scalia last month, but warned they were setting a “precedent” and should expect it to apply to a Republican president in the future.

Mr. Graham, who briefly sought the 2016 Republican presidential nomination, is one of just three senators remaining in office who served on the “Gang of 14,” which brokered a compromise on judicial appointments in 2005 after Democrats filibustered nominations for district and appellate courts put forward by President George W. Bush.

His admonition came as Republicans and Democrats on the Judiciary Committee clashed over filling the court opening, with Republicans insisting that they were doing the right thing by refusing to consider any nominee put forward by Mr. Obama and Democrats accusing them of shirking their constitutional duty.

“The moral high ground is a shaky place to be in the Senate when it comes to judges,” Mr. Graham said. “So I won’t go there.”

The Judiciary Committee chairman, Senator Charles E. Grassley, Republican of Iowa, denounced Democrats for pressuring him to convene confirmation hearings once Mr. Obama picks a nominee, which could happen as soon as next week.

But even as Mr. Grassley defended the Republicans’ stance, his argument was undercut by the unexpected remarks of a colleague, Senator Ron Johnson, Republican of Wisconsin, who is not a member of the Judiciary Committee. Mr. Johnson, speaking on a local radio show, said that Republicans would have taken a different approach to an election-year nominee if it were made by a Republican president.

Such a position sharply contradicts that of senior Republicans, including the Senate majority leader, Mitch McConnell of Kentucky, who have insisted election-year vacancies should not be filled under any circumstances because of the highly contentious political atmosphere.

Asked if Republicans would have acted differently if Mitt Romney were president, Mr. Johnson replied, “It’s a different situation, and generally, and this is the way it works out politically, if you are replacing, if a conservative president is replacing a conservative justice, you know, there’s a little more accommodation to it.”

Mr. Graham’s point was more nuanced and potentially troublesome: that Republicans and Democrats had once again painted themselves into partisan corners and the independence of the judiciary would probably suffer as a result.

To some degree, Mr. Graham’s remarks bolstered the Democrats’ contention that Republicans’ refusal to consider Mr. Obama’s nominee is a level of obstruction previously unseen in the Senate. At the same time, however, Mr. Graham said the Republican position was justified and brought about by Democrats themselves because of a unilateral change in rules they made in 2013 to overcome Republican filibusters of judicial nominees.

“We’re setting a precedent here today — Republicans are — that in the last year at least of a lame duck eight-year term, I would say it’s going to be a four-year term, that you are not going to fill a vacancy of the Supreme Court, based on what we are doing here today,” Mr. Graham said. “That’s going to be the new rule.”

Mr. Graham also had another caution for Republicans: that Hillary Clinton, if elected president, would probably pick a more liberal justice than Mr. Obama and that he and other Republicans would have little choice but to confirm that judge, just as they confirmed Mr. Obama’s first two Supreme Court picks, Sonia Sotomayor and Elena Kagan.

“I voted for Sotomayor and Kagan not because I would have picked them, but because I thought the president of the United States deserves the right to pick judges of their philosophy and that goes with winning the White House,” Graham said.

The 2013 rules change that riled Mr. Graham makes it easier for the majority party in the Senate to confirm judicial nominees, on a simple up-or-down vote, potentially with no support from the minority.

At an afternoon meeting at the White House, Democrats on the Senate Judiciary Committee told Mr. Obama’s senior advisers the president should nominate someone quickly to intensify pressure on Republicans to allow hearings to begin.

“We can do this,” said Senator Patrick J. Leahy of Vermont, after a meeting that included Denis McDonough, Mr. Obama’s chief of staff; Neil Eggleston, the White House counsel; and Valerie Jarrett, a senior adviser. “I’m convinced it is going to be a good nominee, and I am convinced that with that nominee, we can tell the American people, ‘Don’t break precedent.’ ”

No specific names came up at the meeting, said Senator Charles E. Schumer, Democrat of New York, nor did a timetable for Mr. Obama to choose a nominee.

Earlier in the day, Mr. Obama gave no further clues into his thinking, saying only that he was committed to finding “an outstanding jurist, who has impeccable legal credentials, who, by historical standards, would not even be questioned as qualified for the court.”

In defending the Republican position, Mr. Grassley again invoked remarks by Vice President Joseph R. Biden Jr. when Mr. Biden was the committee chairman in 1992, in which he urged that no Supreme Court vacancy be filled in a presidential election year. Mr. Biden said he was speaking hypothetically, apparently out of concern of a voluntary retirement before the end of President George Bush’s term.

Mr. Grassley noted that no Democrat had disputed the remarks at the time.

A version of this article appears in print on , on Page A21 of the New York edition with the headline: G.O.P. Senator Warns of Costs of Partisanship in Court Vacancy. Order Reprints | Today’s Paper | Subscribe