The S&P 500 has had a strong year so far in 2023, with the benchmark index producing a 15% total return through Nov. 9. However, there are still some potentially negative catalysts that could cause the overall stock market to take a dive.

If a market crash arrives, some stocks will be better positioned than others. These two, in particular, focus on recession-resistant businesses and have certain advantages that should get them through a market crash relatively unscathed.

Recession-resistant businesses with a big advantage

To me, Berkshire Hathaway (BRK.A -0.76%) (BRK.B -0.69%) is the clear answer to the question, "If you had to own only one stock during a bear market, what would it be?"

For one thing, Berkshire has a diversified income stream, with over 60 subsidiary businesses and a stock portfolio worth about $350 billion. Not only that, but most of its larger businesses are designed to weather recessions just fine. As an example, GEICO will still collect auto insurance premiums, and Berkshire Hathaway Energy will still get paid for providing utilities, even in a bad economy.

However, the biggest reason I think Berkshire is an excellent hedge against a market crash is because it has more than $157 billion in cash and equivalents on its balance sheet. As Warren Buffett has said, Berkshire aims to be a provider of liquidity to the economy during tough times, and this strategy has served the company well over the years. During the financial crisis, Berkshire was able to make savvy investments in Bank of America (NYSE: BAC) and Goldman Sachs (NYSE: GS), and if another crash came, Berkshire would be heading into it with more cash than it has ever had before. In short, few companies (if any) would be able to not only survive but take advantage of a market crash to the extent that Berkshire could.

A resilient portfolio and cheap valuation

Before we go any further, it's important to acknowledge that Realty Income (O -0.17%) has dramatically underperformed the S&P 500 in 2023. But at the current price, it looks like an excellent hedge against a market crash for a couple of reasons.

First, when a recession or economic uncertainty arrives, certain types of businesses tend to perform better than most. For example, businesses that sell things people need tend to do better than businesses that sell things people want. Businesses that use a discount-based model often perform better in bad times when consumers are looking to save money -- this is why Walmart (NYSE: WMT) was one of the best performers in the entire stock market in the 2008 market crash. And these are the types of tenants that occupy the bulk of Realty Income's more than 13,000 properties. Even in tough times, Realty Income has managed to not only survive but to steadily increase its income and continue to reward shareholders. In fact, Realty Income has increased its monthly dividend at least once per quarter for more than 25 years.

Second, Realty Income is a beaten-down stock primarily because of interest rate pressures, not because of anything fundamentally wrong with its business. It has a 6.1% dividend yield that is very safe, and the monthly dividend payments are likely to keep growing.

Plus, keep in mind that while Realty Income is primarily beaten down because of interest rates, that could work both ways. If a recession or market crash arrives, it could prompt the Federal Reserve to start cutting rates sooner than expected, which would likely be a positive catalyst for real estate investment trusts in general.

A couple of caveats

First off, I have absolutely no idea if we'll get a stock market crash in the next couple of years -- and despite what you may see on TV, neither does anyone else. There are simply too many variables at work, and nobody has a crystal ball. However, I own both of these stocks because they are set up to perform well over the long run, no matter what the overall stock market does.

Second, if a market crash does come, it could certainly impact the stock prices of Berkshire and Realty Income. My point is that their respective businesses should make it through a downturn just fine and are likely to emerge even stronger on the other side. But their share prices could take investors on quite a roller coaster ride, so be prepared to ride out some ups and downs.