Uber Technologies Inc.’s ridership rebounded strongly in the most recent quarter from last year’s pandemic lows, but a continuing driver shortage and uncertainty about how the Delta variant will affect consumer behavior pushed its shares lower.

The company said Wednesday its adjusted loss excluding tax, interest and some costs narrowed to $509 million in the second quarter from $837 million in the year-earlier period. Analysts polled by FactSet expected an adjusted loss before items of $322 million. Uber spent money in the quarter on incentives to woo drivers amid a shortage that has driven up passenger fares. Its shares fell more than 5% in after-hours trading.

Rival Lyft Inc. on Tuesday turned its first quarterly profit on that basis. The company hit that milestone a quarter earlier than expected, in part because ridership rebounded and it reined in costs.

Uber’s rides business is profitable by that measure, but its bottom line is dragged down by its capital-intensive food-delivery business. The company said it sees its loss by that measure narrowing to less than $100 million in the current quarter, and that it remains on track to post a profit by that measure by the fourth quarter.

Uber is among the companies that were both walloped by the pandemic, as cities went into lockdown and ridership plummeted, and benefited from people stuck at home turning in record numbers to food delivery. Easing pandemic restrictions boosted Uber’s rides business in the second quarter, but rising Covid-19 infections could damp prospects in the near-future.

Chief Executive Officer Dara Khosrowshahi said the company’s ride bookings grew in July from the previous month but cautioned that “no one can predict what happens with Delta going forward.”

Uber benefited from people stuck at home during the pandemic turning in record numbers to food delivery.

Photo: Akio Kon/Bloomberg News

The San Francisco-based company reported record bookings in the second quarter. The company’s bookings grew 114% year-over-year to $21.9 billion in the three months ended in June. Bookings for Uber Eats, its food-delivery arm, grew 85% while the ride-hailing business more than doubled from the lows of last year.

The company expects to beat its bookings record in the current quarter. It said it expected third-quarter bookings between $22 billion and $24 billion, in line with analysts’ average estimate of $23 billion.

Bookings allow the company and investors to gauge consumer demand since they represent the total value of trips or food booked on Uber’s platform. The company earns revenue by taking a cut from bookings. Second-quarter revenue more than doubled.

The company posted a rare net profit of $1.1 billion on the back of gains from its investments in Didi Global Inc. and Aurora Innovation Inc. But Didi’s continuing woes with regulators in China may negatively affect Uber’s net income in the third quarter.

A near-term challenge for Uber and Lyft is wooing drivers back to their platforms and containing skyrocketing passenger fares. Lyft said third-quarter revenue would be hurt by its spending on driver incentives, which it hopes will alleviate the continuing shortage and drive down fares in the near term. Its shares fell more than 10% Wednesday on that guidance.

Uber said it didn’t plan to spend significantly more on incentives in the third quarter. It told analysts Wednesday that new driver additions in the U.S. in July grew 30% from the previous month, even as it pulled back on some incentives. Lyft said 50% more drivers had returned to the platform in the second quarter over the first quarter.

As part of its path to profitability, Uber cut staff and shed noncore businesses. It has also looked for ways to strengthen its booming delivery business, which became a lifeline during the health crisis. More recently, it has expanded into delivering everything from groceries and flowers to drugs.

SHARE YOUR THOUGHTS

What did you find most interesting in Uber’s quarterly report? Join the conversation below.

Uber said in February it was buying alcohol-delivery service Drizly for $1.1 billion in stock and cash to expand beyond meal delivery. That came after last year’s $2.65 billion deal for smaller food-delivery rival Postmates Inc.

The company last month also said it was investing in its growing logistics operations with the $2.25 billion acquisition of technology-focused services provider Transplace in a cash and stock deal.