If you've suffered through the market's decline over the last 12 months, it's understandable why selling off your shares and sitting on a pile of cash looks pretty attractive right now. With so much uncertainty circulating and the Federal Reserve aiming to keep raising rates to tame inflation, the prospect of a quick recovery seems increasingly distant.

But getting out of the market entirely would be a huge mistake. Rather than dooming your wealth to a losing battle against inflation inside a checking or savings account, investors should consider rotating their funds into a couple of stable, consistently performing companies that are equipped to survive the current storm.

If you're at a loss for which businesses might be a good fit, there are two in particular which could be up your alley. Here's a look at each.

An investor leans back in chair while smiling and touching head.

Image source: Getty Images.

1. Becton, Dickinson

Becton, Dickinson's (BDX 1.27%) shares are so solid that they've gained around 0.9% of their value amid this year's correction of more than 15% in the market. A quick look at the company's line of business makes it no surprise why that's the case. It profitably makes a slew of workhorse healthcare products like catheters, surgical tools, and intravenous sets, as well as more specialized offerings like cell analyzers for laboratories and diagnostic centers.

The majority of Becton's $5 billion in fiscal Q2 revenue stems from sales to healthcare providers, but sales to biomedical researchers are also a significant segment, accounting for $1.4 billion during the quarter. And because demand for many of its products is both constant and high, it's no wonder why its trailing 12-month revenue grew by 159.2% over the last 10 years, reaching $19.9 billion.

There's more to this stock's stability than its profitability and product offerings, though. BD pays a dividend that's increased every year for the last 50 years and counting, though its forward yield is on the low side at 1.4%. Given that it also performs share buybacks regularly, its shares thus have two different mechanisms for stabilizing and increasing their price regardless of the market environment. 

Just don't expect it to outperform the market every year. Management is targeting a long-term revenue growth rate of around 5.5% as it's highly unlikely that hospitals and clinics will suddenly need large additional volumes of its core product offerings. Still, compared to the 0% that your money would grow if you kept it in cash rather than in equities, it's a great option for investors seeking refuge from falling prices across the market.

2. Costco Wholesale

Costco Wholesale (COST 0.23%) is another rock-solid stock that's a significantly better investment than fleeing to cash right now. In case you're not familiar, Costco sells groceries, clothes, household goods, appliances, alcohol, and consumer health products, not to mention gasoline, tools, car insurance, vacation packages, and a bazillion other things.

This isn't just any variety store though, as only card-carrying members who pay for the privilege are allowed to shop at its warehouses and online storefront. Overall, it's the world's third-largest retailer, with a market cap of around $219 billion and trailing 12-month revenue of $210.2 billion. 

This is a relatively safe stock and a highly stable company for several reasons, starting with its value proposition to its customers. Though customers (including yours truly) are obligated to pay a membership fee and purchase goods in larger quantities than they might prefer, they gain access to significantly lower prices than they would find elsewhere, which draws them in.

Plus, Costco's very generous return policy and legendary customer service ensure that people are happy with what they end up buying. And that's why 92% of its members in the U.S. and Canada opt to renew their subscriptions every year, contributing to trailing 12-month inflows totaling $4 billion from renewals.

Beyond a great relationship with its customers, the wholesaler is also notoriously cost-sensitive, which means investors don't need to worry much about overzealous expansion giving way to losses. Its profit margin is quite thin at around 2.6%, and its total annual expenses represent just over 96.5% of its revenue, but that proportion has barely budged over the last 10 years.

In the meantime, its trailing 12-month net income has burgeoned by 249% to reach over $5.5 billion, so it's clear that its low-cost strategy is working quite well.

Finally, Costco pays a small dividend, which currently has a forward yield of around 0.7%. Since the dividend's start in 2004, management has hiked the payout quite frequently in addition to paying numerous special dividends. As a result, the dividend has seen a compound annual growth rate (CAGR) of 13%.

Even though the yield is quite small, with growth like that it's easy to see how holding Costco shares is a significantly better idea than holding only cash. And that's before even getting into the fact that its returns grew by more than 663% in the past 10 years, smashing the market's total return of around 268%.