Could Mr. King suffer a similar fate in the general election? He does not seem overly worried.

“I am running on my record,” Mr. King said in an interview. “I get things done, whether it’s ISIS, the Gateway tunnel, Sandy funding or MS-13. On MS-13, I got President Trump to come here. I don’t think any president has ever come into Long Island on an issue before. They come to raise money or campaign.”

If there were to be a Crowley-like upset, there would need to be a Democrat cast in the role, if not the mold, of Ms. Ocasio-Cortez. Liuba Grechen Shirley believes she can be that person.

The granddaughter of Russian immigrants and the daughter of a single mother who teaches in public schools, Ms. Grechen Shirley previously worked in global economic development and human rights for nonprofit groups, as well as at the United Nations Foundation and New York University.

After President Trump was elected, she formed a local group of Indivisible, the liberal grass-roots network, on Long Island, where she had settled with her husband in her hometown, Amityville.

She organized rallies and letter-writing campaigns, directing her anger at Representative King. She said she objected to his vote to repeal the Affordable Care Act, known as Obamacare, as well as his views on everything from abortion (he is against it) to the administration’s polarizing travel ban (he was a vocal supporter).