Warren Buffett thinks that near-term economic and market forecasts are "worse than useless." Maybe he's right. But many investors (including yours truly) just can't help themselves: We still try to guess what might happen in the coming months.

I tell you that because my near-term thinking weighs quite heavily on which stocks I like the most right now. My hunch is that the U.S. economy is headed for a mild recession. I'm not alone in that view; the Federal Reserve expects one, too.

Like most investors who aren't billionaires with the surname Buffett, I don't like to see the stocks I buy go down. That's why if I were to invest $20,000 in stocks right now, I would focus on companies that are practically recession-proof and have great long-term prospects. Here are the three best stocks meeting those criteria.

1. Brookfield Infrastructure

Brookfield Infrastructure (BIP -0.47%) (BIPC 0.32%) is already a big winner so far in 2023. The infrastructure stock has soared close to 16% and should have more room to run.

The company believes it will be able to deliver average annual total returns of between 12% and 15% over the long term. Since the company's initial public offering in 2008, its annualized total return has been even higher.

Brookfield's distributions play an important role in its total return. The yield currently stands at nearly 4.3%. The company expects to grow its distribution between 5% and 9% each year.

For anyone concerned about a looming recession, Brookfield's business is quite resilient. The company owns utilities, railroads, toll roads, pipelines, cell towers, data centers, and more. Close to 90% of Brookfield's funds from operations (FFO) are either contracted or regulated. 

2. Dollar General

When the going gets tough, the tough get going... to discount retailers such as Dollar General (DG 0.30%). Consumers looking to stretch their budget dollars during economic downturns have a lot to like about the company with its nearly 19,150 stores located within roughly 75% of the U.S. population.

Investors have a lot to like about Dollar General, as well. Granted, the stock hasn't performed all that great thus far in 2023. But that's just a temporary blip. Dollar General's shares have still more than doubled over the last five years, even with the year-to-date decline.

The company continues to churn out solid growth. In its latest quarter, net sales jumped nearly 18% year over year. Earnings per share increased by more than 15%.

Look for Dollar General to keep it up -- and not just in a recession. The company plans to add new stores. It's rolling out more non-consumable products. And Dollar General is even making money through in-store advertising these days.

3. Vertex Pharmaceuticals

Vertex Pharmaceuticals (VRTX -1.02%) just might be the textbook stock to own during a recession. Its cystic fibrosis (CF) therapies have no competition. Patients won't quit taking the company's potentially life-saving drugs just because the economy is weak.

But Vertex is also a great stock to buy and hold, regardless of what the economy does. It could be poised to shift into a much higher growth trajectory over the next few years.

Vertex and its partner, CRISPR Therapeutics, await regulatory approvals for exa-cel in basically curing sickle cell disease and transfusion-dependent beta-thalassemia. If the gene-editing therapy is approved as widely expected, it should generate billions of dollars in peak annual sales.

That's just the tip of the iceberg. Vertex's pipeline features two other candidates with near-term commercial opportunities that could be blockbusters. It also is evaluating additional promising therapies in earlier-stage clinical studies.