“I will see how much I can earn,” Mr. Wen said. “If I can’t earn much, even if it’s legal now, there’s no point in doing it.”

He added that he thought many drivers would fail the licensing process and that he was wary of the GPS tracking devices the new law says must be installed on their vehicles as a safety measure. Similar devices have led to limits on how much time drivers can spend on the road in trucking, he said.

“I know the tracking devices,” he said. “Once you install that and drive more than eight hours a day, you will be fined, and your company won’t pay the fine.”

Experts said there was nothing in the law to validate Mr. Wen’s concerns.

Uber and Didi issued statements welcoming the regulation. In a note from the senior vice president of corporate development for Uber’s Chinese arm, Zhen Liu, the company said it was “regulation-ready” and would be working with local authorities to put the regulations into practice.

Didi said its drivers would begin applying for local licenses. Didi’s statement praised elements of the rules, like the fact that ride-hailing companies will be allowed to set their own prices.

Calling the new law a “milestone” for China’s sharing economy, Wu Shenkuo, a Beijing Normal University law professor, said he did not see any evidence that the law would specifically take aim at foreign companies. Still, he said, the companies must take care to comply with the rules, which will be put in place locally.

“Companies need to adjust to the new law, especially in terms of applying for licenses, screening drivers and equipping cars,” he said, adding that the law creates a model as China seeks to regulate new internet-based industries that conflict with existing businesses. Taxi drivers in China have held mass protests over ride-hailing apps, which they say are unfair competition.

“From what I can see now, it is very likely that companies will give out less subsidies, raise the rate up for car-hailing, and as a consequence, there might be fewer part-time drivers,” he added.