House Republicans countered the Democrats’ bill with a more modest measure, which drew support from eight Democrats when it came to a vote on Thursday. That measure, an amalgam of other bills that have drawn bipartisan support, would also cap out-of-pocket expenses and require insurance companies to make information available about drug prices to patients in doctors’ offices before doctors prescribe them. But it excludes the Medicare negotiation provision.

Mr. Trump campaigned in 2016 on allowing the government to negotiate drug prices, but Republicans argued that giving that power to the government would force pharmaceutical companies to eliminate research and development, depriving the public of lifesaving medicines.

“For an issue as crucial as lowering the cost of prescription drugs for Americans, partisanship should be set aside,” Representative Kevin McCarthy of California, the Republican leader, said as he made his party’s closing argument for his bill. He warned that the Democrats’ bill was “opening the door to a government takeover of our prescription drug market.”

Representative Greg Walden, Republican of Oregon, who managed the bill for Republicans on the House floor, cited a Congressional Budget Office estimate showing that the Democrats’ measure would result in 40 fewer drugs over the next two decades.

Democrats say their bill addresses research and development concerns by allocating more than $10 billion to the National Institutes of Health for biomedical research, with the goal of advancing breakthrough cures. The Congressional Budget Office has estimated that the bill would save taxpayers $5 billion over a 10-year period.

Allowing Medicare to negotiate prices has been a long-sought goal of Democrats; because the insurance program buys drugs in bulk, it can effectively set the price for all insurers. It was a matter of intense debate in 2003, when the Republican-led Congress passed the bill creating Medicare Part D, which allows Medicare to pay for the cost of prescription drugs.

Since that time, the rising list prices of brand-name drugs, coupled with insurance plans that have increasingly raised deductibles and asked consumers to pay more out of pocket, have left many Americans facing difficult choices about whether to forgo medicine in favor of other necessities, including food.