Major indexes have carried many top stocks lower this year. As the bear market emerged, even some of the healthiest companies saw their shares drop or stagnate. This presented a buying opportunity for long-term investors. But there's another potential buying opportunity out there, and that's the idea of snapping up stocks that have defied the bear market.

Let's talk about three of these in the healthcare industry. They've outperformed the S&P 500 index by far this year, and it wasn't due to pure luck. Each of these companies is offering investors a solid reason to buy right now.

1. Axsome Therapeutics

Shares of Axsome Therapeutics (AXSM -2.61%) have climbed 64% this year. Most of the gains came in recent weeks after the company's great news: It won U.S. regulatory approval for Auvelity, its drug for major depressive disorder (MDD).

What sets Auvelity apart from other MDD drugs is that it works very quickly. Patients start to see big improvement in their symptoms after only one week. Most antidepressants take as long as three weeks -- and that's just for signs of initial improvement.

Auvelity is on track to become a blockbuster. It may bring in worldwide sales of $1.3 billion by 2029, according to a Global Data forecast. Importantly, the company says Auvelity's patents protect it until at least 2037.

Axsome also acquired a drug this year -- Sunosi from Jazz Pharmaceuticals. It treats excessive sleepiness in those suffering from narcolepsy or obstructive sleep apnea. Sunosi sales surged 104% last year to $57.9 million. All of this means Axsome now has two commercialized products with solid growth potential. That opens the door to revenue growth -- and more share gains down the road.

2. Vertex Pharmaceuticals

Investors' excitement about Vertex Pharmaceuticals (VRTX -1.02%) has led the stock to a 33% gain this year. What's the reason for this excitement? It has to do with Vertex's pipeline. Vertex has a blockbuster cystic fibrosis business. But investors have worried about the company's ability to expand beyond this specialty.

Vertex is proving it can do it. The company and partner CRISPR Therapeutics are advancing their gene-editing treatment candidate for blood disorders toward the finish line.

The companies plan to apply for regulatory approval this year in Europe and the U.K. They also are involved in discussions with the U.S. Food and Drug Administration regarding an upcoming submission. The candidate may be big. That's because it's a one-time curative treatment for beta thalassemia and sickle cell disease.

Vertex is also advancing promising candidates for two common problems where need is high: pain management and type 1 diabetes (T1D). It is readying to launch a phase 3 trial for the pain candidate and the T1D candidate is in a phase 1/2 trial. Success could represent a huge breakthrough as the candidate is designed to be a functional cure for T1D.

Vertex shares look cheap -- trading at 20 times forward earnings estimates -- considering the potential of these programs.

3. McKesson

McKesson (MCK 0.64%) shares have advanced 46% this year. But the potential is far from over. McKesson distributes drugs and medical supplies, and it offers various services for healthcare companies such as clinical trial design.

The company benefits even through a difficult economy because individuals and healthcare companies truly need its services at all times. Since McKesson doesn't develop drugs itself, it doesn't carry the risk of potential clinical trial failures. This makes it a rather safe healthcare stock for long-term investors.

Revenue has been on the rise over time at McKesson. Earnings and measures such as return on invested capital and free cash flow could gain over the coming years thanks to a move it is making now. The company is exiting its European businesses to put a focus on "the highest growth and highest margin areas of the company." It sees oncology and biopharma services as huge growth opportunities.

All of this is reason to be optimistic about McKesson's future. Its share gains have lifted its forward price-to-earnings ratio to 15. But considering McKesson's business today and future prospects, there's plenty of room for its valuation to climb further over the long term.