It has been a terrible year for the stock market so far thanks to multiple headwinds ranging from geopolitical instability in Europe to rising interest rates to surging inflation. These factors (and others) have all contributed to the S&P 500 being down about 22% from highs set in January.

Growth stocks have been hit even harder, with a 36.7% slide in the tech-heavy Nasdaq-100 Technology Sector index that contains several fast-growing companies. With the S&P 500 entering bear market territory and analysts expecting the stock market to slide further, it won't be surprising to see stocks of fast-growing companies head lower. A market sell-off is worrying, but it can also help long-term investors buy shares of some solid companies on the cheap and set their portfolios up for long-term gains.

Apple (AAPL -1.22%) and Palo Alto Networks (PANW -1.22%) are two such potential growth plays that seem worth buying and holding for a long time following their steep declines in 2022. Let's see why.

1. Apple

Apple doesn't appear to be a growth stock at first, as the tech giant's revenue in the second quarter of fiscal 2022 (which ended on March 26) had increased just 9% year over year. However, the company had generated $97 billion in revenue during the quarter, which means that Apple already has a huge revenue base, and growing that base substantially would require a major catalyst.

For instance, the company has generated $221 billion in revenue in the first half of the current fiscal year. Analysts expect Apple to clock $394 billion in revenue in fiscal 2022, which would be an 8% increase over last year's $366 billion. So a $30 billion increase in Apple's top line during a year doesn't look like much, given its massive revenue base.

However, there are a few catalysts that could help Apple increase its revenue substantially in the long run and help make it a growth stock worth holding on to. The services business is one such catalyst, as it is growing at a faster pace than Apple's overall revenue.

Apple has generated $39.3 billion in revenue from its services business in the first half of fiscal 2022, an increase of 20% over the prior-year period. The segment's growth has outpaced the 8% increase in the company's product revenue in the first half of the fiscal year. Apple's huge installed base of devices, at 1.8 billion as of January, is a key reason why the services business could keep growing at a terrific pace for a long time to come.

Apple's installed base is expected to exceed 2 billion by the end of 2022. This huge installed base means Apple has a massive pool of users to whom it can sell services such as music, gaming, cloud storage, TV, and fitness, among others. Morgan Stanley had estimated that services could become a $100 billion business for Apple in terms of annual revenue by 2023, and the company seems on its way to hitting that mark at its current pace of growth.

What's more, Apple is reportedly taking steps to ensure that its installed user base grows further, which would lead to an increase in both product and services revenue in the long run. The tech giant is expected to launch a mixed-reality headset next year that would be able to switch between augmented reality (AR) and virtual reality (VR), giving Apple another avenue to serve content to users.

Similarly, Apple is reportedly working on a self-driving car that could be announced by 2025. This would unlock another massive opportunity for the company, with analysts predicting that an entry into self-driving cars could help Apple double its top line and market capitalization in the long run.

All this indicates that Apple could very well turn out to be a growth stock in the long run, as it is looking to disrupt nascent markets with its rumored product development moves. And with the stock trading at just 21 times trailing earnings as compared to the Nasdaq-100's multiple of 26, buying and holding Apple for the long run looks like a smart thing to do.

2. Palo Alto Networks

The cybersecurity industry is growing at a nice clip, which benefits Palo Alto Networks. This is evident from the company's recent results, with its fiscal 2022 third-quarter revenue jumping 29% year over year to $1.4 billion. Palo Alto's adjusted net income for the quarter had also increased 30% year over year to $1.79 per share.

The healthy demand for Palo Alto's offerings allowed the company to raise its full-year outlook once again. The company expects to finish the year with a 29% increase in revenue to $5.49 billion, while billings -- which refers to Palo Alto's potential revenue from subscriptions, support, and product sales -- are expected to jump between 30% and 31% this year to $7.1 billion.

More importantly, solid demand for Palo Alto's offerings is evident from the company's remaining performance obligations, which increased a whopping 40% year over year to $6.9 billion last quarter. This metric refers to the total value of customer contracts for which Palo Alto is yet to provide services, so it is yet to invoice those amounts to customers and recognize revenue from the same.

The big jump in Palo Alto's remaining performance obligations last quarter -- which outpaced its actual revenue growth -- points toward healthy revenue growth in the future. Palo Alto has generated $5.17 billion in revenue in the trailing 12 months, and remaining performance obligations indicate that it is well on its way to growing its top line at a nice clip going forward.

Additionally, Palo Alto could sustain its terrific growth for years to come. That's because the global cybersecurity market is expected to clock a compound annual growth rate of 13.4% through 2029 and hit $376 billion in revenue. Palo Alto is well placed to take advantage of this secular growth, as it controlled nearly 19% of the cybersecurity market a year ago, making it the top player in this space.

Management pointed out on the latest earnings conference call that Palo Alto is consolidating its market share and expects to sustain its gains. More specifically, Palo Alto ended 2021 with a 27% share of the market for cybersecurity appliances, while its share of virtual firewalls was up to 34.5% from 28.4% at the end of 2020.

With Palo Alto stock trading at 9 times sales this year as compared to last year's multiple of 12, investors have an opportunity to buy this cybersecurity stock at a relatively cheap valuation and set their portfolios up for long-term gains, considering the massive opportunity it is sitting on.