WASHINGTON — The Supreme Court on Friday upheld the fee that is added to phone bills to provide billions of dollars a year in subsidized phone and internet services in schools, libraries and rural areas.

The justices, by a 6-3 vote, reversed an appeals court ruling that had struck down as unconstitutional the Universal Service Fund, the charge that has been added to phone bills for nearly 30 years.

At arguments in March, liberal and conservative justices alike expressed concerns about the potentially devastating consequences of eliminating the fund, which has benefited tens of millions of Americans.

The Federal Communications Commission collects the money from telecommunications providers, which pass the cost on to their customers.

A conservative advocacy group, Consumers’ Research, had challenged the practice. The justices had previously denied two appeals from the group after federal appeals courts upheld the program. But the full 5th U.S. Circuit Court of Appeals, among the nation’s most conservative, ruled 9-7 that the method of funding is unconstitutional.

The 5th Circuit held that Congress had given too much authority to the FCC and the agency in turn had ceded too much power to a private entity, or administrator.

The last time the Supreme Court invoked what is known as the nondelegation doctrine to strike down a federal law was in 1935. But several conservative justices have suggested they are open to breathing new life into the legal doctrine.

President Donald Trump’s administration defended the FCC program. The appeal was initially filed by President Joe Biden’s administration.