So far, 2022 has been a pretty hectic year for the market. But successful investors will know to ignore all the volatility and noise and focus on what matters most. The market will recover in the long run, and those individual companies whose prospects remain intact will bounce back.

That means the recent downturn has a bit of a silver lining: Opportunistic investors can buy shares of great companies on the dip. Let's look at two top stocks that have performed worse than the broader market this year: DexCom (DXCM 2.89%) and Microsoft (MSFT 0.37%). Here is why both are worth buying now and holding on to for a while. 

DXCM Chart

DXCM data by YCharts

DexCom's G6 device and accessories.

Image source: Getty Images.

1. DexCom

Shares of medical devices specialist DexCom have dropped by 39% year to date. On one hand, investors may rightfully be worried about the company's declining top-line growth rates. Of course, marketwide issues -- including geopolitical tensions and interest rate hikes in the U.S. -- did not help either. But there are good reasons to be optimistic about DexCom. It is one of the leaders in the market for continuous glucose monitoring (CGM) systems.

These devices help diabetes patients automatically keep track of their blood glucose levels. Using CGM systems is associated with better health outcomes for diabetics. DexCom's own G6 CGM system continues to be highly successful. In the first quarter, the company's revenue -- which it generates through the sale of the G6 and accessories -- increased by 25% year over year to $629 million.

DexCom's top line has grown at a good clip in recent years, thanks to the continued adoption of the G6. But we haven't seen the best of DexCom just yet. Here are three reasons why.

First, the company estimates that there remains significant room to grow in the CGM market -- even in the U.S., a leader in the adoption of this technology. Meanwhile, it is currently expanding into international markets, and by the second half of 2023, these efforts should triple its total addressable market.

Second, the company is currently working on a successor to the G6, namely the G7. This device will be an improvement over its predecessor in terms of achieving better health outcomes.

The G7 recently received regulatory clearance in Europe. DexCom submitted the new device for review to authorities in the U.S. in the fourth quarter of 2021, and a regulatory nod from there could drop before the end of the year.

Third, the diabetes population is projected to continue growing rapidly.This unfortunate reality means that innovative companies like DexCom that help diabetes patients live better lives will be in even higher demand.

Given the growth opportunities ahead, investors should look past DexCom's declining revenue growth rates as the company has plenty of fuel to continue delivering solid financial results for years. And considering how much its shares have dropped recently, now is a great time to initiate a position in this healthcare stock.

2. Microsoft

Microsoft has also been subject to the recent sell-off that particularly impacted growth stocks. Thankfully, the tech giant is arguably as robust as ever. Those who have held shares of Microsoft for a while have been handsomely rewarded. The company long-ago established a dominant spot in the market for computer operating systems and applications -- and built an incredibly valuable brand in the process.

In 2021, Microsoft was the fourth-most valuable brand in the world, according to Statista. The company will almost certainly continue to thrive thanks to the services it offers, many of which have now become integral parts of the day-to-day lives of individuals and businesses.

For instance, Microsoft's productivity tools, including Word, Excel, Teams, and Outlook, continue to be used by millions of people worldwide. The company has also become a giant in cloud computing thanks to Microsoft Azure, coming in second in terms of market share as of the fourth quarter of 2021.

Microsoft has more recently expanded its footprint in the gaming industry with the planned acquisition of Activision Blizzard in an all-cash transaction valued at $68.7 billion.

With a host of long-term opportunities to grab onto -- both the gaming and cloud computing industries are still growing rapidly -- and the cash flow it generates, Microsoft is more than capable of rebounding from the poor stock performance it has so far shown this year. Patient investors should ride out the storm and stick with this tech giant.