Many of the most-recognized companies haven't defied today's bear market. Across industries, headwinds such as rising inflation and general economic woes are weighing on companies and stock performance. But some stocks have managed to evade the doldrums and even post double-digit share price gains.

Now, the question is: Should you hop on the bandwagon and buy shares of some of the top performers? It's great to see the market excited about a particular company. But you won't want to jump into every story.

Some companies may not have the strength needed to power your portfolio over time. It's important to consider players on a case-by-case basis. Let's take a look at three.

1. Vertex Pharmaceuticals

Vertex Pharmaceuticals (VRTX 0.20%) has climbed more than 40% since the start of the year, and for good reason. The company is the global leader in the billion-dollar cystic fibrosis (CF) treatment market. And sales of its biggest blockbuster -- Trikafta -- keep on growing.

Net product revenue rose 5% in the U.S. in the most recent quarter and 46% internationally. The company expects gains to continue as Trikafta gains reimbursements in certain countries and indications in younger age groups. Vertex also is studying a candidate in phase 3 trials that may equal or beat Trikafta. And Vertex is working with partner Moderna on a candidate for those who can't be treated with Vertex's current drugs.

But Vertex may soon expand well beyond CF. The company is submitting its candidate for blood disorders for regulatory approval in the U.S., Europe, and the U.K. as of this month. If approved, it holds blockbuster potential.

Vertex also just launched a phase 3 trial for its acute pain candidate. And it's progressing in a phase 1/2 trial for type 1 diabetes. Both of these treatment areas represent huge opportunities.

Now let's talk valuation. Vertex shares are trading for 24 times trailing-12-month earnings. That's lower than 30 a few months ago and much lower than levels a couple of years ago. At the same time, revenue is much higher today. Considering this and growth prospects, it's not too late to get in on this top performer.

2. Campbell Soup

Campbell Soup (CPB 1.12%) has increased 20% so far this year. The company is known for soup (of course) and other products such as Kettle brand chips and Pepperidge Farm cookies. And this may be a big reason for the stock's gains this year. In times of economic woes, people still keep essentials like soups and even snacks on their shopping lists.

Now, let's take a look at Campbell's growth. Over the past three years, revenue and net income have been on the decline. And for the fiscal 2022 full year, the company recently reported a 24% decrease in diluted earnings per share on a GAAP basis. Net sales increased 1%. Campbell also hasn't been immune to the impact of higher inflation and supply chain problems.

All of this means that, yes, to a certain degree Campbell's earnings may be safer at the moment than those of a company selling nonessentials. And Campbell says its investment in its brands, cost savings efforts, and supply chain improvements will spur growth. It forecasts 4% to 6% growth in net sales in the 2023 fiscal year.

Still, Campbell's growth probably won't be strong enough to sustain the sort of share price increases we've seen this year. Today, Campbell is trading for 18 times forward earnings estimates. Considering the revenue trend, valuation doesn't look particularly attractive right now.

3. McKesson

McKesson (MCK 1.16%) shares have advanced 57% this year. The company brings investors the safety of a healthcare company -- without the big risk of failure of a potential drug or device in development. That's because McKesson doesn't make pharmaceutical products; it distributes them. The company also provides various services to biopharmaceutical companies.

McKesson is at a turning point right now. The company is in the process of streamlining its business to favor higher-margin areas. This means it is divesting its European businesses. The company already has taken care of this in 11 out of 12 European markets. Those higher-margin areas include the Canadian business, biopharma services, and oncology.

Annual revenue and profit have been on the rise at McKesson. And return on invested capital (ROIC) is heading higher too. McKesson's shift to higher-margin areas could help boost ROIC further.

MCK Revenue (Annual) Chart

MCK Revenue (Annual) data by YCharts

McKesson recently lifted its guidance for fiscal 2023 earnings per diluted share to the range of $24.45 to $24.95. That's up from $23.95 to $24.65.

Now let's take a look at valuation. McKesson is trading for 16 times forward earnings estimates. This is higher than the level of about 13 earlier in the year. At the same time, McKesson's new focus should result in higher margins and considerable growth over time.

So for the long-term investor, the stock looks like a bargain right now. And that means McKesson is a great choice to add to your portfolio -- even after this year's top performance.