A recession is coming. At least, that's what the Federal Reserve and many economists think. If they're right, many investors might be inclined to hunker down rather than buy stocks.

I don't blame anyone for being apprehensive about the stock market. At the same time, though, I think there are some stocks that are good bets regardless of what happens with the economy. Here are my picks for the best stocks to invest $5,000 in right now.

1. Brookfield Infrastructure

If an economic downturn is indeed on the way, investing in recession-proof stocks and industries is a smart strategy. Brookfield Infrastructure (BIP -0.47%) (BIPC -0.28%) looks like a great choice, in my view.

The company's name gives away its business. Brookfield Infrastructure owns infrastructure assets, including data centers, electricity distribution and transmission lines, natural gas pipelines, railways, semiconductor manufacturing foundries, telecom towers, and toll roads.

Here's the important thing to know about Brookfield's assets: They generate steady cash flow month in and month out. Roughly 90% of the company's funds from operations is contracted or regulated.

One of the biggest pluses of this stock is its juicy dividend. Brookfield Infrastructures' dividend yield currently tops 4.4%. The company has increased its distribution since 2012 by a compound annual growth rate of 9%. 

2. PepsiCo

The consumer staples sector also usually holds up relatively well during a recession. While there are plenty of potential stocks in this sector to buy, I especially like PepsiCo (PEP 0.88%).

This food and beverage giant really flexed its muscles in the first quarter of 2023. PepsiCo reported year-over-year net revenue growth of 10.2% despite currency headwinds and raised its full-year guidance.

Even if the U.S. economy declines, it doesn't necessarily mean that the rest of the world will follow. PepsiCo provides significant international exposure with nearly one-third of its revenue generated outside of North America.

Most importantly, though, PepsiCo offers the stability that investors long for during times of uncertainty. The company's financial strength, brand loyalty, and impressive track record of increasing its dividend for 50 consecutive years help make it a safe port in a storm.

3. Vertex Pharmaceuticals

We'd have a hard time picking a company in a better position to weather an economic downturn than Vertex Pharmaceuticals (VRTX -1.14%). Why? Vertex sells the only drugs approved to treat the underlying cause of cystic fibrosis (CF). These therapies are must-haves, not nice-to-haves.

Thanks to the success of its CF drugs, Vertex is highly profitable. It also boasts a hefty cash stockpile that totaled $10.8 billion at the end of 2022.

But Vertex isn't just a recession play. The big biotech's growth prospects could (and I think will) improve significantly over the next few years.

Vertex currently awaits regulatory approvals of exa-cel, a gene-editing therapy that can functionally cure sickle cell disease and transfusion-dependent beta-thalassemia in many patients. Two other therapies with multibillion-dollar sales potential could also launch in the near future -- non-opioid pain drug VX-548 and a CF triple-drug combo featuring vanzacaftor.

That's not all. Vertex's pipeline includes other potential game-changers as well. The company is evaluating inaxaplin in pivotal clinical studies targeting APOL1-mediated kidney disease, an indication with a bigger patient population than CF. It also has a promising early stage program that just might be able to cure type 1 diabetes down the road. With so many shots on goal, I predict that Vertex will be one of the biggest monster stocks of this decade.