Sen. Majority Leader Mitch McConnell (R-Ky.) (Jacquelyn Martin/Associated Press)

Senate Republicans are suddenly grappling with a demanding agenda riddled with political peril, as they prepare to try to confirm a new FBI director and reshape the nation’s health-care system — two challenges that have landed before them in rapid succession.

President Trump’s abrupt firing of James B. Comey has raised concerns in both parties that threaten to linger in the effort to replace him. The president’s controversial decision could also take a toll on the pace of the health-care talks, which were already off to a rocky start.

“Anytime you have something else come along when you’re debating legislation, while you’re trying to iron out something, it can — it takes some of the momentum away,” Sen. Mike Lee (R-Utah) said Sunday on “Fox News Sunday.” But he added that on health care, “We’re going to get it done one way or another.”

For Republican senators, it is a moment of reckoning with an unpredictable president, whom most supported in the election and have championed in office. Many said the Comey firing caught them by surprise. And while it looked for months as though the health-care push might fizzle in the House, Trump and others revived it, leaving the Senate to pick up the baton in a contentious effort to undo key parts of the law known as Obamacare.

Sen. Bill Cassidy (R-La.) (Joshua Roberts/Reuters)

Either task on its own would be challenging. Trying to do both has left some Republicans speechless.

When asked last week whether the White House had injected uncertainty into the Senate health-care negotiations — which, before Comey’s firing, was the Senate GOP’s main focus — Sen. Bill Cassidy (R-La.) simply grinned, stepped into an elevator and smiled broadly again as the door shut.

Trump’s dismissal of Comey has continued to seize the attention of senators in both parties since he was ousted last week. It is expected to draw more attention this week : Senate leaders have invited Deputy Attorney General Rod J. Rosenstein to brief all senators, but aides said Sunday that the time and format of his appearance is not yet determined.

At some point, Trump will nominate a new FBI director. The nominee will have to endure a grilling in the Senate Judiciary Committee and is expected to encounter heavy skepticism from Democrats.

Senate Republicans hold a 52-to-48 advantage over Democrats and can ultimately confirm an FBI director with a simple majority under the Senate’s rules. But concerns that some GOP senators have raised about the timing of Comey’s dismissal and uncertainty about whom Trump will tap to replace him could lead to a dicey confirmation process.

Amid reports that Trump might tap Sen. John Cornyn (R-Tex.) — a former judge and Texas attorney general — to lead the FBI, Sen. Lindsey O. Graham (R-S.C.) told NBC’s “Meet the Press” on Sunday that Trump should instead “pick someone who comes from within the ranks or has such a reputation that has no political background at all that can go into the job on day one.”

Sen. John Thune (R-S.D.) (Aaron P. Bernstein/Getty Images)

“I don’t think Jim Comey leaving was a surprise. I think the timing was a surprise,” said Sen. James Lankford (R-Okla.), a member of the Intelligence Committee. The committee is investigating potential Russian meddling in the 2016 election, including possible coordination with Trump associates.

Senate Judiciary Committee Chairman Charles E. Grassley (R-Iowa) said he does not plan to recommend any Comey replacements to the White House unless he is asked to do so. Lee used his Fox interview to revive calls for Trump to tap Judge Merrick Garland, Barack Obama’s stalled Supreme Court nominee.

Democrats have accused Trump of engaging in Nixonian tactics in his dismissal of Comey and suggested that the former director may have been fired over his investigation into whether Trump associates coordinated with Russia to interfere in the campaign. They have used Comey’s ouster to amplify their calls for a special prosecutor and an independent investigation of Russian meddling.

To apply further pressure, Democrats used procedural tactics to delay at least one committee hearing this week before they abandoned their blockade to allow an Intelligence Committee hearing to go forward.

From a procedural standpoint, Democrats can slow, but not stop, Republicans on executive branch confirmations — so long as they hold together. While that has been less of a problem in the Senate than in the House, some Democrats now say they believe the circumstances of the Comey firing could put some cracks in the Republican coalition.

“I’m finding more of the Republicans who are saying privately and quietly that this is worth looking into,” said Senate Minority Whip Richard J. Durbin (D-Ill.). “It is worth investigating.”

Even if Republicans stick together to confirm a new FBI director, time spent on that is time not spent on health care. Senate Republicans are trying to write their own health-care bill after the House narrowly passed its own version last week, an ambitious and complicated endeavor.

“It is going to be difficult at best. Anything like that adds to it,” said Sen. Orrin G. Hatch (R-Utah), speaking of Comey firing’s impact on health-care and tax retooling, another major GOP goal.

Hatch is one of 13 members of an all-Republican group of senators that is meeting twice a week to talk about health care. The group has come under criticism for not including any women. And deep differences exist among the members of the group, as well as the broader Senate GOP Conference, about how to approach Medicaid, health-care tax credits and preexisting medical conditions.

Health-care talks in the Senate could drag on for months. GOP leaders have been reluctant to put a timetable on their efforts. But already, the House GOP leadership is applying pressure on them to plow ahead swiftly.

“I really do believe we can get this by the end of the summer. I hope the Senate can move this bill fairly quickly — hopefully in a month or two,” House Speaker Paul D. Ryan (R-Wis.) said in an interview with Fox News.

Senate Democrats, meanwhile, are keeping tabs on public opinion to determine how far they can go in obstructing Trump’s legislative agenda without angering voters who already view Congress as hopelessly gridlocked, according to Democratic aides who spoke on the condition of anonymity to speak about strategy. As Trump’s favorability falls, Democrats grow more hopeful that Republicans will abandon efforts to protect him, the aides said.

For much of the year, Senate Majority Leader Mitch McConnell (R-Ky.) has focused on more routine business, like vetting and approving Trump administration nominees and rolling back federal regulations. He also helped shepherd Neil M. Gorsuch’s confirmation to the Supreme Court, notching a big early win for the new Republican-controlled government.

Under current law, the legislative window for voting on regulations closed this week — just as Senate Republicans started sizing up their more challenging tasks ahead. Some are trying to take it in stride.

“We should be able to walk, chew gum and confirm an FBI director at the same time,” Sen. Marco Rubio (R-Fla.) said.

Ed O’Keefe contributed to this report.