WASHINGTON — Members of Congress from both parties served notice on pharmaceutical companies on Tuesday that the days of unchecked drug-price increases were over and that they would be held politically accountable for exorbitant prices.

The new reality became apparent at simultaneous but separate hearings of House and Senate committees where lawmakers said that the relentless increases were unsustainable and unacceptable.

“There is a strong bipartisan consensus that we must do something to rein in out-of-control price increases,” said Representative Elijah E. Cummings, Democrat of Maryland and the chairman of the House Committee on Oversight and Reform. “Drug companies make money hand over fist by raising the prices of their drugs — often without justification and sometimes overnight — while patients are left holding the bill.”

On the other side of the Capitol, Senator Charles E. Grassley, Republican of Iowa and the chairman of the Finance Committee, and Senator Ron Wyden of Oregon, the senior Democrat on the panel, denounced drug company executives who they said had refused to testify voluntarily.