Investing your money in stocks is often a great way to build wealth over the long term, but it's not always the best move. In some cases, you're better off applying the cash you have to other, more pressing financial needs first.

At this year's annual Berkshire Hathaway (BRK.A -0.30%) (BRK.B -0.26%) shareholders meeting, Warren Buffett told investors the first thing he'd do if he came into any money is pay off credit card debt (if he had any). The COVID-19 pandemic and the recession that it's caused only further demonstrates why it's important to pay off personal debt sooner rather than later.

Warren Buffett

Image Source: The Motley Fool

Interest at 18% or more would trump any stock return -- over the long term

Buffett's rationale for paying down debt is simple: The interest saved would be much higher than the returns could earn from investing in the markets. He used an example percentage of 18% but in many cases, credit cards have much higher interest rates. He admitted that "I don't know how to make 18%."

To pay down a credit card balance by $10,000 with an interest rate of 18% would mean saving $1,800 per year in interest charges. To consistently earn $1,800/year from a $10,000 investment in stocks simply isn't sustainable nor is it a realistic goal over the long term.

A high-flying stock like Teladoc Health (TDOC -2.91%) has more than doubled this year but it would be unrealistic to expect those types of returns consistently. It's dwarfing the S&P 500 this year, which is down 6%, but that won't always be the case. As the company continues to grow and mature, and perhaps even pay a dividend, its returns will come down to more reasonable levels.

Right now the stock is a scorching buy, especially as demand for telehealth services is on the rise amid the coronavirus pandemic. But a few years from now, there could more competitors, less growth, and less of a reason for investors to be excited about the stock. A big part of why Teladoc is flying is that its sales growth is through the roof. From just $77 million in revenue back in 2015, Teladoc's top line has soared more than 600% to $553 million in 2019.

Even in its first-quarter results of fiscal 2020, which Teladoc released on April 29, the New York-based company's sales were still up an incredible 41% from the prior-year period. That's a stellar performance, and as people stay home and look for affordable healthcare options, Teladoc could continue to see a surge in sales. The company gives people without healthcare coverage the option to pay just $75 for a virtual visit with a doctor, which can help save them money during a recession.

For now, it's conceivable that the stock does continue generating double-digit returns in the next year, and perhaps even beyond that, but it's far from guaranteed. 

What's a more realistic long-term return?

A stock like Medtronic (MDT -1.41%) may provide investors a better idea of what kind of return is more realistic from a healthcare stock. Medtronic has been around for decades, and with a market cap of over $120 billion, the medical device maker is nearly ten times the value of Teladoc today.

Over the past five years, Medtronic's stock has produced a fairly paltry return of 20%. Over a five-year period, that averages out to a compounded annual growth rate (CAGR) of just 3.7%. If you throw in its dividend, which pays 2.4%, then you could be looking at a total return of over 6% per year -- still nowhere near Teladoc's returns. And while Medtronic's dividend is better than the 2% that the average S&P 500 stock pays, the broader index has achieved far better returns over five years, totaling more than 44%.

One of Buffett's favorite stocks, Coca-Cola (KO 0.31%), doesn't fare any better. In five years, it's up just 14%, and that averages out to a CAGR of only 2.7%. The Dividend King pays a better dividend, which yields 3.4%, but that's still not enough to make up the gap. On an individual stock basis, it's a challenge to get near a combined annual rate of 10%, especially when it comes to safe investments. 

That's why many successful investors point to investing in an index like the S&P 500 as a good way to balance returns with stability. The index would've averaged a CAGR of 7.6%, better than the average returns from both Coca-Cola and Medtronic. And when adding in the dividend, you'll be close to 10% but still below the 18% interest rate that you might pay on a credit card balance.

It comes down to comparing interest rate versus potential investment return

Anytime you're looking for a place to apply your money toward, you'll want to compare the interest rates you're paying on your credit cards or debt versus what kind of return you can expect to make from different investment options. If you have credit card debt, that will likely be the highest percentage you can apply your cash toward. If you're debt-free, your best options may be holding the cash in your bank account where you'll likely earn less than 2% and investing it in stocks.

And even before you decide to invest in stocks outside of your 401k or retirement account, it's always a good idea to first build up an emergency fund to ensure that you've got a large cash cushion to help pay for unexpected expenses and emergencies that may arise. Otherwise, you run the risk of having to run your credit cards back up when an unexpected cost occurs.

Compared to a bank account, stocks are much better options, especially over the long term. Whether it's Teladoc, Medtronic, Coca-Cola, or the S&P 500, investments such as these would be safe bets to generate better returns than what you'd likely earn from your bank account (or even a bond, for that matter).

It's also important to take into account the potential returns along with the risk involved. While you may have the potential to earn more than 18% on an individual stock, high returns are often riskier and less sustainable over a long period. That's why the priority for investors should always be to pay down debt and then invest in steady and safe investments that can generate long-term growth.