The healthcare industry can make for a safe place to invest regardless of the macroeconomic conditions. It's one of the last areas where consumers would look to cut their spending for the sake of tightening up their budgets. And whether it's human health or pet health, both are options investors should consider gaining exposure to, as they could deliver surprisingly good performances in 2023.

A couple of healthcare stocks that are diversified and that could be good buys heading into the new year are AstraZeneca (AZN 0.19%) and PetMed Express (PETS -0.74%). Let's find out a bit more about these two stocks.

1. AstraZeneca

AstraZeneca's business performed well in 2022, but its stock isn't doing as well as perhaps it should be. Up 14% year to date, it's well outperforming the S&P 500 (which is firmly in negative territory). However, the pharmaceutical company is also trading at a forward price-to-earnings multiple of 17. That's in line with the S&P average, but this is a stock that deserves to trade at a premium given the potential it offers.

The company has 18 phase 3 clinical trial readouts scheduled for next year, so there are lots of potential new drugs or treatments that could send the stock higher. Obviously, there are no guarantees when it comes to drug trials. There's no knowing which, if any, will yield positive results, but given the company's impressive track record, AstraZeneca stock is worth the risk.

The company already has a hugely promising drug in Enhertu, which has demonstrated positive results in treating both low and high levels of HER2 breast cancer. At its peak anticipated sales, it could generate up to $6.6 billion in annual revenue for the business.

AstraZeneca is also armed with a diverse mix of products that can add some cushion next year and offer plenty of growth opportunities. In the third quarter, revenue of $11 billion was up 19% year over year when excluding the impact of shifting foreign exchange rates. Its three major operating segments -- rare disease, oncology, and cardiovascular, renal, and metabolism -- all generated double-digit percentage year-over-year growth on a constant-currency basis. AstraZeneca's diversification gives it paths for growth when more focused healthcare businesses may struggle.

Along with all that, its dividend yields 2.2% at the current share price (better than the S&P 500's average yield of 1.7%), adding to the case for AstraZeneca as a desirable stock to own next year.

2. PetMed Express

PetMed Express is an online pet pharmacy and operates the 1800petmeds.com website, where consumers can buy everything they need to keep their pets healthy. The stock was a hot buy at the start of the pandemic, when a steep spike in pet adoptions generated a surge in demand for pet products and services. Things have slowed drastically since that boom, and the results are evident in PetMed's recent revenue numbers.

PETS Revenue (Quarterly YoY Growth) Chart

PETS Revenue (Quarterly YoY Growth) data by YCharts.

Shares of PetMed are down 22% so far this year. However, there's a reason for optimism: According to location analytics company Placer.ai, the pet stores and services segment has been one of the best-performing areas in retail in recent months. Compared to 2019 levels, foot traffic was up nearly 16% in October, at a time when shopping centers, clothing stores, and home improvement stores saw declines. And that upward trend has been consistent for multiple months.

PetMed doesn't operate storefronts that would allow it to benefit from that rising foot traffic, but the key takeaway is that there's still strong demand for pet-related services and supplies, suggesting that this may be a more resilient part of the economy. Only discount and dollar stores saw more of an increase in foot traffic in October at 20%.

In PetMed's fiscal 2022 second quarter, which ended Sept. 30, its sales fell 3% year over year to $65.4 million. Management also seemed to confirm in its earnings release that it was seeing signs of hope, as CEO Matt Hulett said "we were pleased to see revenue begin to stabilize this quarter after multiple quarters of decline." Meanwhile, PetMed could benefit from a more stable top line in the future as the company now says autoship subscriptions account for 39% of revenue (up from 34% just a quarter earlier).

Trading at 25 times its projected future earnings, this healthcare stock is a bit expensive, but PetMed could be an underrated stock to hold next year thanks to more consistent sales and a resilient demand for pet care.