Some stocks have had a rough few months, but the short-term pain has opened up some long-term investment opportunities. Companies like Twilio (TWLO 1.36%), Cloudflare (NET 1.40%), and Unity Software (U -1.40%) all got a bit ahead of themselves from a stock-trading standpoint and had some stretched valuations in mid-2021. Now, they have returned to a normal state, and long-term investors should be considering these three businesses.

1. Twilio

If you've ever interacted with a business through texts, you've very likely experienced Twilio's product. It makes a difficult task easy through its communication APIs (application program interfaces). With these tools, even those who are not software engineers can program the complicated code necessary to communicate with customers through text, email, or voice.

Doctor using a cellphone.

Image source: Getty Images.

Twilio has made multiple acquisitions in its quest to become the go-to solution for customer communication. The purchases skew revenue results, making its organic revenue -- which excludes revenue contributions from acquisitions made after Nov. 1, 2020 -- an important metric for investors to study. For 2021, Twilio's organic revenue grew 42% year over year, backing up management's promise to increase organic revenue by at least 30% from 2020 through 2024.

Long-term revenue growth like management is projecting isn't easy to achieve, but Twilio has proved it can do it.

The stock's valuation peaked at 30 times sales in 2021 but has since crashed to 10. While this isn't a risk-free valuation, the last time it traded this low was during the peak of the pandemic crash. Before that, Twilio traded for around 15 times sales.

With management's guidance for 30% organic revenue growth and a valuation below historical averages, investors should feel confident in Twilio's long-term prospects.

2. Cloudflare

Cloudflare's mission is simple: "to build a better internet." It aims to do this by getting rid of expensive on-site equipment and hosting websites on its data centers strategically positioned in over 250 cities across the globe.

Because those websites are closer to end-users everywhere, users experience higher speeds because they are routed to the nearest server rather than a singular host. Cloudflare also offers top-notch cybersecurity for its clients, reducing expensive IT costs.

After a successful 2020 where revenue grew 50% year over year, Cloudflare rattled off another successful year with 52% revenue growth in 2021. While that increase remained about the same, its profitability significantly improved during 2021, with its non-GAAP (generally accepted accounting principles) operating margin going from an 8% loss to a 1% loss throughout the year. With management guiding for a 1.5% operating margin for 2022, investors can be confident Cloudflare is progressing toward profitability.

Like Twilio, Cloudflare's valuation reached an extreme level (more than 100 times sales) in 2021. It has since fallen to around 57, which is still expensive, making its valuation a risk investors must understand. But with an estimated market opportunity of $100 billion by 2024, I think it is a great purchase today. Innovative companies' stocks are rarely cheap, so sometimes investors have to bite the bullet and purchase shares even at high valuations.

3. Unity Software

When it comes to 3D animation, few have better software than Unity. Designers and developers can use its tools to create and monetize video games or create a realistic rendition of a product still in development. It also has augmented reality (AR) technologies that allow construction crews to overlay drawings that engineers and architects made to visualize what the end product should look like.

Unity cracked $1 billion in annual revenue during 2021, with sales up 44% to $1.1 billion. For 2022, management expects 35% revenue growth at the midpoint, reflecting the vision laid out by chief financial officer Luis Visoso of at least 30% revenue growth over the long term.

Stock-based compensation made up a massive chunk of Unity's operating expenses in 2021, leading to a significant loss. Its stock-based compensation bill came to $347 million in 2021, which made up practically half of operating expenses. The expense led to a loss from operations of 48%, but if stock-based compensation is taken away (for a non-GAAP figure), this metric improves to only a 5% loss.

Person designing a video game on a computer.

Designing a video game. Image source: Getty Images.

Investors must be mindful that their shares are constantly being diluted with high stock-based compensation. However, if the growth overshadows the dilution, shareholders can still make a profitable investment in Unity Software.

All three of these stocks are trading down 50% or more from their all-time high despite reporting great 2021 results. Long-term investors can snag this group for a reduced price and potentially generate a solid return as long as the businesses continue to execute.