Inflation, recession, or not, investors are getting more pumped about the economy. The S&P 500 hit a new high last week and is up 11% year to date, and many companies are reporting growth and stability.

Home Depot (HD -0.30%) is reporting declining sales, but investors are cheering its resilience despite inflation and getting ready for a rebound. Realty Income (O 0.28%), conversely, is still suffering from negative investor sentiment related to high interest rates.

Both are top dividend stocks that provide passive income regardless of what's happening in the markets. That makes them great picks for when there's uncertainty or any time, and today you can buy them before they get back to gains.

1. Home Depot: Leader of home improvement

Home Depot has delivered incredible gains for shareholders over time, crushing the S&P 500. It's the largest home improvement chain in the world, with more than 2,300 stores throughout North America.

Its opportunities for new stores may be limited, but it's still planning to open 80 new stores over the next five years. More of its strategy revolves around improving its model and deepening relationships with customers to generate higher comparable sales and bigger profits.

For example, Home Depot completely revamped its omnichannel network just before the pandemic. It ended up costing a lot of money and taking more time than anticipated, but the result was a formidable business that meets customer needs through multiple channels -- just in time for lockdowns. Home Depot demonstrated incredible growth throughout that time period, and just as it benefited from those tailwinds, it's now negatively affected by inflation. These are all external factors that will always affect retailers.

The internal business is strong and healthy, and Home Depot continues to invest in and strengthen itself. It recently acquired several companies aimed at targeting the pro market, and it's well-positioned to spring back to growth under improved conditions.

Home Depot stock is flat this year, and its dividend yields 2.5%. Now is a great time to stock up on shares.

2. Realty Income: The ideal dividend stock

Realty Income has pretty much anything you'd want in a dividend stock. It pays a high-yielding and growing dividend, it has a reliable track record, and it operates a stable, leading business. Even more, it pays a monthly dividend, a rare benefit on the market. It has paid a dividend for 647 months consecutively (that's more than 53 years), with 107 quarterly increases.

It's a retail real estate investment trust (REIT), which means it leases properties to tenants primarily in retail industries. However, Realty Income has grown over time, and today it services several non-retail industries as well. It grows through buying properties and acquisitions, and today it is the sixth-largest REIT in the world, with more than 15,000 properties.

Realty Income touts its diversification as a benefit because the company is well-hedged against different economic variables that might affect some of its tenants. It has about 1,500 tenants in 89 different industries. However, its leased properties are concentrated in essential categories that are generally more resistant to inflation and other economic pressure. Some of its top-20 clients include Dollar General, BJ's Wholesale Club, and Walmart, and almost 20% of its properties are leased to grocery stores and convenience stores. It has a 98.6% occupancy rate, rarely dipping below that, and with long-term leases at favorable rates.

Investors are down on real estate stocks in the high-interest-rate environment. Realty Income stock has lost about 8% of its value over the past year, and its dividend yields around 5.6% at the current price. It's a great time to lock in a bargain price and benefit from a high rate.