WASHINGTON — The Senate on Thursday gave final approval to legislation to finance the Food and Drug Administration, clearing the measure for President Trump and tapping drug manufacturers once again to help pay for the federal review of prescription drugs and medical devices.

The 94-to-1 vote came just hours after the Senate passed a separate bill expanding access to experimental treatments for people with terminal illnesses. This bill, the Right to Try Act, will now go to the House, where more than three dozen lawmakers have endorsed similar legislation.

Mr. Trump is expected to sign the bill reauthorizing user fees to pay for the review of medical devices, brand-name drugs, generic drugs and biosimilars, which are copycat versions of costly biologic drugs made from living organisms.

The House approved the user fee bill by voice vote on July 12.

The vote on Thursday capped an often frustrating seven months for Republicans, who had hoped to churn out reams of conservative legislation with their control of both chambers and the White House.

Since the failure of the Senate’s health care repeal bill last week, lawmakers have seemed resigned to more incremental successes.

“We’re passing critical legislation, we’re confirming nominees to important positions,” Senator Mitch McConnell of Kentucky, the majority leader, said from the Senate floor on Thursday, citing a series of veterans bills and the confirmation this week of a new F.B.I. director, Christopher A. Wray.

In a late burst of activity before a monthlong summer break, the Senate on Thursday confirmed more than 60 of President Trump’s nominees.

They included former Senator Kay Bailey Hutchison of Texas to be the next ambassador to NATO, David J. Kautter to be the top tax policy official at the Treasury and Dr. Jerome M. Adams to be surgeon general of the United States.

Yet, even on their final day in session, lawmakers were reminded of the often uncomfortable marriage between Mr. Trump and the Republican-led Congress.

Mr. Trump lashed out over a bill — which he signed grudgingly this week — to sanction Russia for meddling in last year’s presidential election and for its aggression toward its neighbors.

The legislation also limits Mr. Trump’s ability to lift or suspend the sanctions himself.

The measure, which the administration sought to block as it moved through the Capitol in recent weeks, is among the most significant accomplishments of this Congress.

Some senators are also maneuvering in response to White House criticism of Robert S. Mueller III, the special counsel leading the investigation into ties between people in Mr. Trump’s orbit and Russia.

On Thursday, Senator Thom Tillis, Republican of North Carolina, and Senator Chris Coons, Democrat of Delaware, introduced legislation that would allow for judicial review if a special counsel were removed.

The F.D.A. bill, which passed overwhelmingly in both houses, was a struggle.

Lawmakers spent more than a year forging a consensus among Republicans, Democrats, F.D.A. officials and drug and device companies.

“This is a bill that’s been done the right way,” said Senator Lamar Alexander, Republican of Tennessee and the chairman of the Senate health committee, in a subtle dig at Republican leaders who bypassed the committee and Democrats in a failed push to repeal the Affordable Care Act. “It’s an example of the way the Senate is supposed to work.”

The food and drug agency depends on user fees to finance more than a quarter of its budget and to speed the approval of drugs while maintaining strict safety standards.

The bill includes a proposal by Senator Susan Collins, Republican of Maine, intended to prevent huge, unjustified price increases on decades-old prescription medicines that have no competition.

The legislation directs the agency to speed the review of generic drug applications when products on the market have little or no competition.

The F.D.A. bill also includes new requirements that could increase the number of cancer drugs for children.

Under the bill, manufacturers of new drugs for adult cancer must provide data to the government on how the drugs could also be used to treat cancer in children.

“We’ve already seen, for example, that a drug developed for lung cancer in adults is also effective in treating a cancer of the nervous system in children under age 10,” said Nancy F. Goodman, the executive director of Kids v. Cancer, an advocacy group.

Senator Michael Bennet, Democrat of Colorado, said: “Over the last 20 years, the Food and Drug Administration has approved roughly 190 new cancer treatments for adults but just three new treatments for children. The F.D.A. saw that gap, and they have asked us to close it.’’

The “right to try” bill, introduced by Senator Ron Johnson, Republican of Wisconsin, aims to establish a new pathway for terminally ill patients to gain access to experimental drugs that have not been approved by the F.D.A.

These patients are often extremely ill and unable to participate in clinical trials, or have no other treatment options.

Under current law, drug companies can already provide access to patients outside of clinical trials under a program known as expanded access or compassionate use.

The F.D.A. says it approves about 99 percent of compassionate use requests.

But companies sometimes refuse, fearing that the results could be used against them by the F.D.A.

In some cases, drug makers fear they could be sued by patients who say they have been injured by unapproved drug products.

The bill would establish national standards and rules to help channel drugs still under development to terminally ill patients.

It would also shield pharmaceutical companies and doctors from some of the legal risks of providing drugs that have not been approved by the agency.

Companies that manufacture such drugs and doctors who prescribe them would generally be protected unless they engaged in “reckless or willful misconduct” or “gross negligence” or intentionally harmed a patient.

“These are real people facing their mortality with no hope,” Mr. Johnson said.

Opponents of the bill say there is a difference between dying comfortably and dying horribly, suffering pain and other side effects of an unapproved drug.

Public Citizen, a consumer group, said the bill would “provide false hope to patients” and undermine the F.D.A.’s authority to supervise the use of experimental drug products.