WASHINGTON — When Representative Ryan Costello of Pennsylvania announced on Sunday that he would join more than 40 other congressional Republicans not seeking re-election in November, he left no doubt about the reason: President Trump’s conduct made it impossible to talk about anything else.

Were he running, Mr. Costello said in an interview, he would be inundated with questions about Stephanie Clifford, the pornographic film actress known as Stormy Daniels, who has said she had an affair with Mr. Trump and was threatened to stay silent about it.

“If I had a town hall this week, it would be question after question,” Mr. Costello said. “‘Do you believe him or do you believe her? Why don’t you believe her?’”

While Republicans have been bracing for months for a punishing election in November, they are increasingly alarmed that their losses may be even worse than feared because the midterm campaign appears destined to turn more on the behavior of the man in the White House than any other in decades.