WASHINGTON — The Senate gave final passage on Wednesday to a multibillion-dollar revamp of the veterans health care system, consolidating seven Veterans Affairs Department health programs into one and making it far easier for veterans to take their benefits to private doctors for care.

The legislation, which passed 92 to 5, also expands popular stipends to family caregivers of veterans who served during the Vietnam War era or after. And it establishes a nine-member commission to study the department’s current infrastructure to determine where its health system should expand and contract.

The comprehensive bill had been a year in the making, and ultimately won the support of Republicans and most Democrats. The House passed it last week, 347 to 70, and President Trump plans to sign it into law.

The bill rounds out an ambitious legislative agenda on veterans issues that has bridged the administrations of President Barack Obama and Mr. Trump, and largely united moderates in both parties who set out to make major changes to the department after a 2014 scandal over the manipulation of data on patient wait times. Mr. Trump has already signed laws that make it easier for the department to remove and fire employees and for veterans to appeal benefits decisions, as well as a rewrite of the G.I. Bill for post-9/11 veterans.