Investors are hoping 2023 will be much better than the past 12 months, but there is no guarantee that it will. Some of the economic problems they have encountered this year should persist, and worse, many experts are predicting a recession within the next year. In other words, the market could continue to struggle for a while.

But these issues won't last forever. Eventually, stocks will bottom out, and a rally will follow. In the meantime, buying stocks that can survive in any environment is a good idea. Here are two great examples: Johnson & Johnson (JNJ -0.27%) and Apple (AAPL 0.57%). Here's why these blue chip companies can help investors get through good and bad times. 

1. Johnson & Johnson 

Pharmaceutical giant Johnson & Johnson generates consistent revenue and profits, has a solid pipeline that can allow it to strengthen its lineup of drugs and is an excellent dividend payer. Let's unpack that a bit more, starting with the company's financial results. In the third quarter, J&J's revenue increased by 1.9% year over year to $23.8 billion.

Without the impact of foreign exchange rate dynamics, the company's top line jumped by 8.1% year over year. The drugmaker has a long list of lifesaving medicines that keep growing in sales. They include immunosuppressants Stelara and Tremfya. Revenue from the former grew by 3% year over year to $2.4 billion in the third quarter.

Tremfya's sales soared to $729 million, 35.9% higher than the year-ago period. Johnson & Johnson's lineup also includes cancer medicines Darzalex and Erleada, its COVID-19 vaccine, and more. Economic cycles won't affect patients' needs for important drugs that treat chronic illnesses like plaque psoriasis or potentially deadly diseases like cancer. 

So even with a challenging environment, Johnson & Johnson's financial results should remain somewhat decent. The company also has an impressive pipeline, even for a pharmaceutical company of its size. It includes no less than 43 programs in late-stage studies alone. In the third quarter, J&J earned four regulatory approvals.

Johnson & Johnson's pipeline can allow it to replace older drugs whose sales are declining. Then there is the company's dividend history. Having raised its payouts for 60 consecutive years, Johnson & Johnson is part of the elite clique of Dividend Kings. It currently offers a yield of 2.55%, slightly above the S&P 500's 1.82%.

The drugmaker is unlikely to cut or suspend its payouts even in a recession. That's great news for income-seeking investors. Johnson & Johnson's business is built to get through even the toughest times. That's why it's been around for more than a century and will survive whatever the economy and the market have in store next year.

2. Apple 

Apple is best known for the iPhone and other innovative gadgets, none of which are cheap. But the company's brand name is so powerful that consumers continue to buy its devices at record levels, even amid an inflationary crisis. In the fourth quarter of its fiscal year 2022, ending on Sept. 24, Apple registered record revenue for that period. 

Its total sales of $90.1 billion increased by 8% year over year.

Obviously, Apple's strong financial results hardly indicate that the company hasn't had issues; even corporations performing well deal with some obstacles. For instance, much of the company's manufacturing for its iPhone happens in China, and the country is currently going through unrest due to its COVID-19 lockdown policies.

This problem and others could certainly continue to weigh on Apple in the near term. Looking beyond that, though, the tech giant is an excellent long-term bet, despite a market cap above $2 trillion. One of Apple's greatest strengths is its ecosystem of users. Those who own an iPhone or some other device can have access to a host of services Apple offers.

That includes iTunes, Apple Pay, iCloud, and more. Apple's goal is to find new ways to monetize these consumers; it has an installed base of more than 1 billion with iPhones, a threshold the company crossed last year. The company's services segment has grown in importance in recent years. It also records much better margins than its products unit. Apple can ride this opportunity for years. 

The company's fintech ambitions also look promising, given that digital payments are on a solid upward path. Be it within fintech or some other market, though, Apple has both the funds to pursue new ventures and a solid track record that strongly suggests that it will successfully find ways to monetize its base of users.

The company can handle the next economic or market crisis, whether next year or after.