Artificial intelligence (AI) could revolutionize the world by automating tedious tasks, reducing errors, and generally increasing efficiency in the workplace and at home. That's why investors have been flocking to invest in companies that may benefit from this developing technology. In most cases, when we think of AI, we think of chipmakers or tech companies that power AI tools.

But one area that may be one of the biggest winners in the AI race is healthcare, which is a market set to reach $194 billion by 2030, according to Allied Market Research. AI could speed up drug development, produce better products, and improve surgical outcomes. So companies selling AI-based products and services could see their earnings and stock prices skyrocket.

As tempting as it may be, though, it's not a good idea to invest in companies just because they're working in this exciting field. Instead, it's important to look at a company's full picture and long-term prospects. Considering this, here's one healthcare AI stock to buy hand over fist right now -- and one to avoid.

Stock to buy: Moderna

Moderna (MRNA 1.69%) may not immediately come to mind when you think of AI. You may associate the company more with its blockbuster coronavirus vaccine. But AI played a behind-the-scenes role in the development of the vaccine and is a force in Moderna's work on other programs.

The biotech company uses messenger RNA as the backbone of its investigational products. Through a vaccine or treatment, mRNA delivers instructions to the body to produce a protein to prevent or treat disease. This worked tremendously well in the company's coronavirus vaccine, and Moderna aims to launch as many as 15 new products across treatment areas over the next five years.

Where does AI come in? Moderna has used it to speed up the discovery process by producing better mRNA sequences -- and faster. That's how it helped support the development of the coronavirus vaccine.

This year, Moderna increased its commitment to AI by signing a deal with International Business Machines, allowing it to use IBM's quantum computing and generative AI platforms for drug development. For instance, Moderna will use IBM's MolFormer, an AI foundation model, to predict a molecule's properties -- and more quickly and efficiently develop potential treatments for disease. Moderna also expanded its offices and workforce, with a goal of scaling its work in AI.

All of this may help Moderna solve one of the biggest problems in drug development -- the slow pace. And this could be an enormous victory, resulting in significant earnings growth over the long term.

But Moderna isn't only about AI. The company has more than 40 programs in development and, as mentioned earlier, is set to launch several new products in the coming years.

So now is a great time to get in on the story. By investing in Moderna, you may benefit from an AI revolution -- and a whole lot more.

Stock to avoid: Recursion Pharmaceuticals

Recursion Pharmaceuticals (RXRX 3.57%) aims to speed up drug discovery through its AI-based Recursion OS platform. The company uses machine learning to identify relationships among the biological and chemical data in its database. From there, it conducts millions of experiments weekly with the goal of finding better drug candidates faster.

Thanks to this platform, Recursion now has nine candidates in the pipeline in the areas of oncology and rare diseases. The most advanced are in phase 2 studies.

As for its financial situation, Recursion is investing a lot in research and development, and that's resulted in a deepening loss. Today, the company says it has enough cash to sustain operations for at least the coming 12 months -- and doesn't expect to generate product revenue any time soon. The biotech also said in a recent filing that it probably will have to raise more capital in order to fund its operations.

This isn't entirely surprising for an early clinical-stage biotech company, but it still represents risk -- and suggests potential growth due to earnings is far off.

Recently, tech giant Nvidia made a $50 million investment in the company, and that increased the stock price. As part of the deal, Nvidia will help Recursion optimize its platform and is offering the company access to its cloud-based tools. Stock-price gains were short-lived, though, and Recursion is now down 11% for the year.

Why should you avoid Recursion? Though the company's technology sounds exciting, it's still too early to say whether it really can speed up the drug development process. I would like to see signs of this through its partnerships with pharmaceutical companies -- or see significant progress from the company's own pipeline before committing to this AI stock.