Is the U.S. in a recession? The country's gross domestic product declined for two consecutive quarters, which signals a recession according to a general rule of thumb. But there is technically more to the definition of a recession than that. Still, the nation's economy isn't in the best shape, and so it never hurts for investors to be prepared for an economic downturn.

With that in mind, let's look at two healthcare stocks that could get you through these challenging times and beyond: Johnson & Johnson (JNJ 0.60%) and Bristol-Myers Squibb (BMY 0.67%).

JNJ Chart

JNJ data by YCharts.

Johnson & Johnson

When it comes to essential products consumers continue to depend on even during economic downturns, it is hard to beat lifesaving medicines. That's right up Johnson & Johnson's alley since the company's pharmaceutical division remains the largest by revenue. The healthcare giant boasts dozens of products, including many blockbusters.

Some top-selling ones include cancer drugs Darzalex and Erleada and immunosuppressants Stelara and Tremfya. All of these products continue to grow their sales at a good clip. Stelara, Darzalex, and Tremfya have already generated more than $1 billion year to date, and Erleada should do so by the end of the year.

During the first quarter, Johnson & Johnson's total sales increased by 3% year over year to $24 billion. While that doesn't look impressive, it is worth noting that strengthening the U.S. dollar harmed the pharma giant's revenue growth. Johnson & Johnson's total sales grew by 8% year over year on an operational basis.

Further, the company's worst-performing segment in terms of top-line operational growth was its consumer health unit, which it will spin off into a stand-alone entity by the end of the year. Johnson & Johnson's pharmaceutical segment reported sales of $13.3 billion, representing a 12.3% year-over-year increase.

Expect Johnson & Johnson's top-line growth to improve as it focuses on its pharmaceutical unit and its medical devices segment. Within the former, the company continues to earn new regulatory approvals thanks to its rich pipeline that boasts several frozen ongoing pipeline programs.

Within medical devices, Johnson & Johnson could make headway in the promising robotic-assisted surgery (RAS) market in the coming years, thanks to its RAS device, Ottava. In other words, the company has plenty of growth avenues to exploit.

Another perk that comes with purchasing J&J shares: he company is a Dividend King, having raised its payouts for 59 consecutive years. Dividend stocks are well-equipped to handle market downturns, and that's one more solid reason to consider this top pharma stock. 

2. Bristol-Myers Squibb

It is always stressful for a drugmaker when it faces patent cliffs for some of its prized products. That's what's going on with Bristol-Myers Squibb. The company's cancer medicine Revlimid -- its top-selling drug last year -- is currently losing sales due to generic competition that started this year in the U.S. That's partly why the company's revenue only increased by 2% year over year to $11.9 billion in the second quarter, although accounting for the impact of foreign exchange, Bristol-Myers' revenue jumped by 5% compared to the year-ago period. 

Thankfully, Bristol-Myers can deal with this and other upcoming patent exclusivity losses. In April, the U.S. Food and Drug Administration (FDA) approved the company's Camzyos, a brand-new medicine indicated to treat  symptomatic New York Heart Association class II-III obstructive hypertrophic cardiomyopathy (a heart-related disorder). In March, it earned approval in the U.S. for another brand-new product, cancer drug, Opdualag.

Just last year, Bristol-Myers' Breyanzi, another cancer medicine, first earned the regulatory nod in the U.S. Bristol-Myers is currently awaiting word from the FDA as it considers the potential approval of yet another of its new products, plaque psoriasis treatment deucravacitinib. 

And that's not counting the company's existing products -- such as cancer medicine Opdivo -- that continue to gain new indications. With a solid pipeline that continues to expand Bristol-Myers' revenue base, the company's future looks bright, even considering its current slump and the economic headwinds we are facing.

Bristol-Myers is a solid, dividend-paying stock, too. It currently offers an above-average yield of 2.93%. Be it for passive income or to help investors deliver market-beating returns, Bristol-Myers is a strong candidate.