EASTPORT, Me. — Senator Susan Collins jogged her way through the Fourth of July parade in this picturesque little port city, handing out American flag stickers to cheers and shouts of “Thank you!” But beneath the bonhomie, there were hints that the once untouchable Republican may be in trouble because of two men: Justice Brett M. Kavanaugh and President Trump.

A retired restaurant worker shouted at Ms. Collins on Thursday to “get those kids out of cages” — a reference to border detention centers — and later invoked her vote to confirm Justice Kavanaugh. An organic-farm worker shouted “Kavanaugh!” as the senator ran past. A local shopkeeper has been sending Ms. Collins letters urging her to live up to the example of Margaret Chase Smith, the iconic Republican senator from Maine who stood up to Joseph McCarthy.

All three voted for Ms. Collins in 2014, persuaded by her reputation as a true moderate. “I want to vote for her again,” said the shopkeeper, Linda Cross Godfrey, 72. “It will be up to her whether I do or not.”

Ms. Collins, who coasted to a fourth term in 2014 with 68 percent of the vote, will be difficult to beat. But the polarization that has swept the nation is seeping into Maine as well, even here in the Collins-friendly part of the state known as Down East, where the nationalization of politics should seem far away. That has raised an important question: Can a cautious politician like Ms. Collins — at 66, the sole remaining New England Republican in Congress — survive in the loud and angry era of #MeToo and Trumpism?