The criticism seems to have had an effect: For now, Anthem appears to be denying fewer claims — though it also expanded its policy to several more states.

“Avoidable visits” are the latest conflict among doctors, hospitals, insurance companies and patients over emergency rooms. And the Anthem policy is just one way that patients seeking emergency care can be stuck with unexpected costs. Some doctors, who fail to sign contracts with insurance companies, are sending patients direct bills for their services.

“It’s the place where the incentives in health care break down,” said Zack Cooper, a health economist at Yale University, who has studied patterns in out-of-network bills. “You’ve ended up with this death struggle between insurers, hospitals and emergency room physicians, and patients get caught in the middle.”

The emergency room, which functions as the front door to most hospitals, contributes a substantial portion to the nation’s enormous health costs. The program by Anthem, the nation’s second-largest insurer, tries to reduce those costs by changing patient behavior. Other insurers are watching carefully. Anthem points to estimates that as many as 5 percent of visits are unnecessary.

“E.R.s are often a time-consuming place to receive care and in many instances 10 times higher in cost than urgent care,” Ms. Becher said.

Anthem began testing its policy in Kentucky in 2015. That’s when Jason Salyers, now 32, who works in the financial aid office of a community college, started having episodes in which he couldn’t breathe. When he went to the emergency room, he was treated for a panic attack. Two days later, he returned, fearful he was having a heart problem.

His pulse, he recalls, was above 150 beats per minute.

“I thought I was dying and I needed to go to the E.R.,” he said.