The kind of market volatility we have experienced in the past year can sometimes rattle investors, drawing their focus away from the long-term mindset that is important to earning excellent returns over time. Panic selling can undoubtedly be satisfying in the moment, but there is a reason legendary investors such as Warren Buffett consider "forever" their favorite investment period.

Few things beat the combined power of time and the compounding effect when looking to accumulate wealth. That's why it's essential to focus on buying stocks worth holding on to for good, even amid challenging market conditions. Biotech company Moderna (MRNA -0.79%) and fintech specialist PayPal (PYPL -1.22%) are two such stocks. Let's consider why. 

1. Moderna 

Are Moderna's growth days over? On the one hand, the biotech will no longer benefit from a significant coronavirus-related tailwind, as the height of the pandemic now looks to be behind us. Moderna's COVID-19 vaccine won't record the kinds of sales figures it did in 2021 and 2022. Despite this issue, Moderna has outperformed the market over the past year.

That performance is largely a result of Moderna's rich pipeline, which promises to yield exciting developments in the coming months and years. In December 2022, the company's shares soared by more than 20% in one day after its personalized cancer vaccine, mRNA-4157/V940, in combination with the cancer drug Keytruda, reported excellent results in a phase 2 clinical trial to reduce the risk of recurrence or death in melanoma patients.

In January, Moderna reported that its investigational respiratory syncytial virus (RSV) vaccine, mRNA-1345, met the primary endpoint in a phase 3 clinical trial. These examples highlight Moderna's potential given the more than one dozen non-coronavirus programs in its portfolio. The biotech's mRNA platform proved itself during the pandemic, and now, it will likely remain important in developing new vaccines and therapeutics.

The mRNA method of developing vaccines is much faster than traditional means, allowing Moderna to bring its products to market in less time and at a fraction of the cost many competing vaccine makers have to bear. Moderna is setting out to make major breakthroughs, too, with a potential vaccine against HIV, treatment for cystic fibrosis, and more.

Furthermore, Moderna has the funds to push many of these programs forward, thanks to the success it has had with its coronavirus vaccine. And soon enough -- within a year or so -- the company should earn approval for its RSV vaccine, allowing it to supplement the revenue it will continue to generate from the coronavirus booster market.

Expect Moderna to start more late-stage studies this year and the next to help set the company up to significantly expand its lineup in the next five years and beyond. Moderna's innovative approach and its rich and promising pipeline make it a solid stock to buy now and forget. 

2. PayPal 

PayPal is a fintech leader with arguably one of the most recognized brands -- a major advantage. The company spent years under the wing of e-commerce giant eBay as its main payment processor. But even after splitting from its former parent company in 2015, PayPal's success has continued. As of the end of 2022, the company had 435 million active accounts, an increase of 2% year over year.

In 2022, PayPal processed an impressive $1.36 trillion in total payment volume, up 9% year over year, and recorded $27.5 billion in revenue, an increase of 8% compared to the year-ago period. Some of PayPal's key metrics aren't growing as fast as they did during the pandemic, which is why it has underperformed the market over the past year.

But that's perfectly normal. People flocked to online shopping and digital payment methods more than they would have otherwise in 2020 and 2021. As usual, zooming out helps put things in perspective. Between 2017 and 2022, PayPal's revenue, active accounts, and total payment volume have registered compound annual growth rates of 16%, 14%, and 24%, respectively.

What's more, among the 1,500 largest online retailers in North America and Europe, PayPal is the most accepted digital wallet with a 79% acceptance rate as of the end of 2022, up from 76% compared to 2021. The second-most popular digital wallet is only carried by 28% of these retailers. That shows the lead PayPal has in this realm, a factor that should help it attract new merchants and customers.

That's because the value of PayPal's platform increases as more people use it, with merchants increasingly more likely to adopt it as it grows in popularity among consumers, and vice versa. All 1,500 of the largest online retailers could adopt PayPal within a few years, and so could many other less popular merchants.

PayPal's future largely depends on the continued rise in digital payments. And in that department, there arguably remains plenty of room to grow, especially in countries with lower internet and e-commerce penetration rates. PayPal is ideally positioned to remain a leader, and it should profit from this long-term trend for years. That's why it's worth investing in the company today and remaining a shareholder for life.