We've already experienced two of the biggest bank failures on record this month. That has shaken confidence in the country's banking system. It's increasing concerns that we could be heading for a challenging economic period. 

Times like this make it difficult to invest with much conviction since more companies could fail if we experience a significant recession. However, many companies have the financial fortitude to endure tough economic times. Because of that, you can invest in them without any concern. Five high-quality companies you can confidently invest $500 in right now are Johnson & Johnson (JNJ -0.29%), Microsoft (MSFT 1.33%), NextEra Energy (NEE 1.25%)Realty Income (O -0.04%), and WM (WM 0.29%). They're industry behemoths with fortress-like financial foundations.

1. One of the healthiest balance sheets around

Johnson & Johnson has one of the strongest financial profiles in the world. The healthcare behemoth has AAA-rated credit (higher than the U.S. government). It has an extraordinarily strong balance sheet with $24 billion of cash and marketable securities against $40 billion of debt. Meanwhile, its business generates $17 billion of cash flow each year. That gives the company the funding to invest in research and development, repurchase shares, and pay a growing dividend to shareholders. Johnson & Johnson offers a 2.9% dividend yield and has increased its payout for 60 straight years. With healthcare spending continuing to rise, Johnson & Johnson should have no problem continuing to grow value for its investors in the future.

2. A cash-rich tech behemoth

Tech giant Microsoft rivals Johnson & Johnson as one of the world's financially strongest companies. The tech giant has AAA-rated credit backed by a fortress-like balance sheet. The company ended 2022 with $99.5 billion of cash and short-term investments against $44.1 billion of long-term debt. Meanwhile, Microsoft generates significant free cash flow ($7.3 billion in the most recent quarter). That gives it the financial flexibility to invest in expanding its operations while returning cash to investors through share repurchases and a growing dividend. Microsoft recently agreed to invest billions of dollars into artificial intelligence (AI) company OpenAI, giving it access to technology it plans to utilize across its other products to extend its lead over the competition. 

3. A leading utility plugged into a powerful trend

NextEra Energy is helping lead the charge in decarbonizing the U.S. economy. The utility is one of the world's largest power producers from the wind and sun. It's also a leader in battery storage. The company expects to invest tens of billions of dollars to expand its clean energy infrastructure in the coming years. It has one of the strongest balance sheets in the utility sector, giving it the flexibility to fund its continued investment. That powers NextEra Energy's view that it can grow its earnings per share by as much as a 9.4% compound annual growth rate over the next few years.

4. A high-quality landlord

Realty Income prides itself on delivering a dependable and growing monthly dividend to its shareholders. The real estate investment trust (REIT) has increased that payout 120 times since its public market listing in 1994. That steady growth should continue. Realty Income owns a high-quality real estate portfolio that skews toward lower-risk properties. Meanwhile, it has one of the strongest balance sheets in the REIT sector. That gives it the financial flexibility to continue acquiring income-producing real estate to grow the dividend. 

5. Turning trash into steady cash flow

WM is one of the country's largest collection, recycling, and disposal services companies. Waste management is a relatively recession-resistant industry, enabling WM to benefit from stable demand and pricing. Because of that, the company expects to produce $2.6 billion to $2.7 billion of free cash flow this year. That will give it money to invest in expanding its operations (including recycling and renewable energy), repurchasing shares, and paying a growing dividend (the company has increased its payout for 20 straight years). 

These high-quality companies can endure a downturn

There's a lot of uncertainty these days, given the impact surging interest rates are having on the banking sector and the broader economy. It's causing investor confidence to erode.

However, while those issues will impact some companies, they will have little effect on Johnson & Johnson, Microsoft, NextEra Energy, Realty Income, and WM. Because of that, those with some idle cash can confidently buy shares in those high-quality companies. They can easily withstand a downturn and are in excellent positions to continue growing value for their investors in the future.