Warren Buffett believes in investing for the long term. That's one of the secrets to his investing success. The billionaire investor once said, "If you aren't willing to own a stock for 10 years, don't even think about owning it for 10 minutes."

Holding a stock for the long term allows you to benefit from the company's earnings growth, in some cases dividends, and overall development in its industry. That's why it's key to choose solid businesses. And one way of doing this is by following Buffett's lead. Let's check out two of the best Buffett stocks to buy for the long haul.

1. Johnson & Johnson

Johnson & Johnson (JNJ -1.21%) is a great choice for the long term for two reasons: its dividend growth and its strong earnings track record. Let's talk about the dividend first. J&J is a Dividend King. That means it's increased its dividend for at least the past 50 years. This is positive because it shows dividend growth is important to the company -- and that means the company is likely to continue along this path.

Passive income is great to have at any time. But it's particularly welcome during market downturns. That's because you can count on this income even if stock performance is down.

As for earnings, J&J has generally grown revenue and net income over time. In 2021, J&J reported more than $93 billion in sales. That represented an increase of about 13% from the previous year.

Moving forward, investors may see even more growth from J&J. The company this year is spinning off its consumer health business into a separate entity. That will leave J&J with its two higher-growth businesses: pharmaceuticals and medtech. This should have a positive impact on earnings over time.

Today, J&J shares are trading for about 16 times forward earnings estimates. This is down from more than 18 a year ago -- and even that level seemed reasonable considering J&J's earnings strength and commitment to dividend increases. So, today, the stock looks like a top buy that you'll want to hold on to well into the future.

2. McKesson

Healthcare stocks are often seen as safe because no matter what the market is doing, people need their medicines and medical treatments. And that supports these companies' earnings. But there's one big risk that comes along with a lot of healthcare companies: that of failure of a potential product in development.

But there's a healthcare player that doesn't carry this risk. I'm talking about McKesson (MCK 0.22%). The company doesn't develop drugs or devices. Instead, it supplies them. And it also offers services to biopharmaceutical companies. So, McKesson is a great -- and maybe even the safest -- way to invest in healthcare.

The company's revenue has climbed over time. And McKesson's latest move to spur growth and its recent investments in the business should lift net income and return on invested capital. These two metrics already are on the rise.

MCK Net Income (Annual) Chart

MCK Net Income (Annual) data by YCharts

So how is McKesson boosting growth? The company is divesting its European businesses. And it's focusing on high-growth areas like oncology and biopharma services -- such as clinical trial design.

McKesson shares climbed 50% last year. But considering the company's earnings track record, recent shift into growth areas, and general business model, the stock still offers plenty of room for gains over time. McKesson trades for only about 15 times forward earnings estimates.

This healthcare company also offers a dividend and has recently repurchased shares. These are signs McKesson believes in its business. Buffett clearly does.