Sometimes investments take years to pay off. That's why being a long-term investor gives you the best shot at generating wealth in the stock market. Ride-hailing company Uber Technologies (UBER -0.38%) has tested investors' patience -- shares are only up 5% since its 2019 initial public offering (IPO)!

But don't give up now. The company has become an industry leader, and its expanding services pave the way for growth. Better yet, the stock could finally deliver some rewarding investment returns.

Here is why Uber is a buy today -- and a potential table-pounding bargain if the market's volatility pushes shares lower.

It's taken a while, but Uber's getting there

Most people are familiar with Uber. It was started in 2009 and is now the leading ride-hailing company in the U.S. It also operates in a handful of international markets. Uber is a two-sided marketplace where passengers can request rides and deliveries, and drivers can supply them. Everything is done through Uber's smartphone app.

Uber has become a large business with $35 billion in annual revenue. However, profitability has been elusive. But Uber is at a critical turning point. The company's revenue began outrunning costs after years of losses, and free cash flow turned positive last year. Additionally, Uber is expected to finally break above even. Analysts are looking for 2023 earnings per share (EPS) of $0.42 after losing $4.65 per share in 2022.

Chart showing Uber's revenue rising and free cash flow turning from negative to positive since 2022.

Data source: YCharts

What comes next could be fun for shareholders. Now that the business is turning a profit, the company's earnings could grow rapidly as revenue continues expanding. Analysts believe EPS could increase by an average of 44% annually over the next three to five years.

Revenue has room to grow

If you're an investor looking five or more years out, the exciting part is that Uber still has many growth levers to pull. First, the broader ride-hailing industry is still young. According to research firm Coherent Market Insights, the global ride-hailing market was worth about $121 billion in 2021. It could grow by an average of 19% annually through the rest of the decade.

Additionally, Uber is branching out to leverage its marketplace and driver footprint in multiple ways. Instead of booking an Uber ride, you can now rent a car or receive delivery of packages and food. That doesn't include the seemingly inevitable autonomous driving opportunity. Self-driving technology has been in the works for years, but what a potential opportunity -- autonomous driving could turn ride-hailing on its head, and Uber has the huge size to jump in when the time is right.

A lot could happen between now and years into the future, so keep your expectations tempered. However, it seems realistic that Uber's internal and external opportunities could generate double-digit revenue growth for a while.

A reasonable price tag with bargain potential?

The stock trades at a forward price-to-earnings (P/E) of about 106 using 2023 analyst EPS estimates. That sounds expensive at face value, but remember that the company should grow earnings by around 40% annually for several years. That means long-term investors could see that valuation become more palatable fairly quickly.

Another way to look at this is the stock's price/earnings-to-growth (PEG) ratio, which compares the valuation to the expected earnings growth. At a PEG ratio of 2.3, Uber isn't a bargain; I would probably want to see that number below 2 for that to be the case. However, someone who's content holding Uber in a long-term portfolio could see impressive returns if the company executes its growth opportunities.

Additionally, the stock market is volatile, and Uber's beta of 1.23 means it could drop further than the broader market if a correction occurs. Investors interested in Uber should consider adding the stock slowly and pounce on a significant dip if volatility strikes again.