Uber Technologies Inc. will sell its China business to Didi Chuxing, the dominant ride-hailing service in the country, according to people familiar with the matter. The deal ends a costly battle between the two companies, which competed for customers and drivers.

The valuation of the combined business will be $35 billion, said the people, who asked not to be named because the details aren't public. Investors in Uber China, an entity owned by San Francisco-based Uber, Baidu Inc. and others, will receive a 20 percent stake in Didi, the people said. Uber will continue to operate its own app in China for now.

In addition to Uber selling its Chinese subsidiary, the complex deal involves Didi making a $1 billion investment in Uber, people familiar with the matter said. Didi had no immediate comment, and Uber declined to comment.