The bear market has sent plenty of great companies into the doldrums. Most of us know that just by looking at our portfolios. And that's OK. We're in this for the long term. Once economic pressures ease, our favorite companies have a great chance of rebounding -- and gaining over time.

Meanwhile, it's always a good idea to pick up a stock that has resisted the general negative market move. Two drugmakers have done just that. Vertex Pharmaceuticals (VRTX -0.06%) and AbbVie (ABBV -4.58%) are both gaining so far this year -- even as the S&P 500 declines. They've climbed 32% and 12%, respectively. The S&P 500 has lost 19%. It's impossible to predict whether this trend will continue. But we can say these two companies have what it takes to keep going strong. Let's find out more.

1. Vertex

Vertex is already bringing in billions of dollars in revenue and profit from its cystic fibrosis (CF) business. The company's top drug, Trikafta, has the ability to treat 90% of CF patients. But it hasn't reached that full population yet. That means there's room for even more growth for this blockbuster.

Meanwhile, Vertex is working on a CF candidate that may be even better than Trikafta. That potential product is in phase 3 trials right now. The company is also developing a treatment for the 10% of patients who can't be helped by Vertex's current CF products. It's partnered with Moderna on this program, and the companies hope to launch clinical trials in the second half.

But what's really sparked investors' interest is Vertex's progress on a program outside of its CF specialty. Vertex and partner CRISPR Therapeutics plan on requesting regulatory approval for their gene-editing treatment for blood disorders by the end of the year. This could be a game-changing product for two reasons. First, treatment options for beta thalassemia and sickle cell disease are limited. And second, the Vertex candidate is a one-time curative treatment.

All this means Vertex may bring in blockbuster revenue -- and profit -- well into the future.

2. AbbVie

AbbVie is on its way to dominating the prescription drug market. The company is expected to hold the biggest share of this market by 2026, according to Evaluate Pharma. This is even as AbbVie's biggest blockbuster -- Humira -- prepares to face biosimilar competition in the U.S. next year. The immunology drug already saw a 22% drop in revenue internationally in the first quarter as competition there heats up.

Still, AbbVie predicts its other immunology drugs, Skyrizi and Rinvoq, together will surpass Humira's peak sales. AbbVie also owns strong neuroscience and aesthetics portfolios. Net revenue climbed 19% and 20%, respectively, in the first quarter. Botox as a therapeutic and bipolar disorder drug Vraylar led gains in neuroscience. Botox as an anti-wrinkle treatment and the Juvederm dermal filler collection led increases in aesthetics.

AbbVie's pipeline is another reason to like this pharmaceutical company. The pipeline includes dozens of candidates in a wide range of treatment areas -- from oncology to eye care. And about 19 candidates are in phase 3. This means new products might be on the horizon.

So, yes, the bad news is that Humira sales are on the decline. But AbbVie has plenty of other products to keep revenue and profit growing over the long term. And that's great news for investors.