The stock market has done incredibly well over the past 12 months. The same can't be said for consumer food brands like PepsiCo (PEP -0.62%). The S&P 500 has posted a 24% total return in the past year, but PepsiCo stock is slightly down as investors worry about declining volumes and the effects of weight-loss drugs on future customer demand.

Despite these fears, PepsiCo just raised its dividend yet again -- marking 52 straight years of dividend increases -- putting its forward dividend yield above 3% for the first time since the March 2020 low. Does that make the stock a good buy for long-term investors?

PEP Total Return Level Chart

PEP Total Return Level data by YCharts

Solid growth, but declining volumes

PepsiCo is more than just its namesake soda brand. The company owns other drinks such as Gatorade as well as the dominant snack food company Frito-Lay, which sells Lays, Tostitos, and other salty snack products. The company reported its fourth-quarter earnings results earlier this year, posting solid revenue growth, with total organic revenue growth up 9% year over year to $91.4 billion.

Despite a global presence, the two most important categories for PespiCo are North American drinks and North American food and snacks. Combined, North American Pepsi and Frito-Lay segments brought in $52 billion in revenue last fiscal year and $9 billion in operating earnings. Its home markets still drive the bus, with the company able to consistently raise prices year after year.

Now, there are fears this two-headed growth engine is over. Last fiscal year, Pepsi's volume declined 5% in North America, with Frito-Lay down 1% compared to the previous year. Both segments are still growing revenue due to price increases, but it is possible that the company is finally hitting a ceiling where consumers are pushing back against price increases for their favorite soda and potato chip brands.

No company has infinite pricing power, and PepsiCo may be stretching its brand power too thin at the moment. Or, perhaps there is another culprit.

Are weight-loss drugs a category killer?

New weight-loss drugs such as Ozempic have taken wealthier countries by storm in the last few years, with millions of people now on these medications. Analysts predict that 7% or more of the United States population could be taking these drugs by 2035. Forty percent of the population is considered obese, and you could make an argument that companies such as PepsiCo are partly to blame for the problem.

These drugs work by depressing cravings and appetites, which lead people to eat fewer calories. More specifically, it looks like people are eating less junk food when using these drugs. That could pose a huge demand problem for Pepsi soda or Lay's potato chips. It is possible that these headwinds are already showing up in Pepsi's operating metrics with volumes suddenly turning down in North America last year.

You might think 7% of the population on Ozempic won't present a huge headwind for PepsiCo. But remember that soda, snack food, and candy consumption is not evenly distributed among the U.S. population; it is skewed toward the obese and diabetic citizens who would be taking Ozempic in this scenario. This could end up being a huge demand hit for PepsiCo if usage of these drugs continues to grow for the rest of this decade.

The stock looks cheap, but don't fly blind here

Even if PepsiCo looks more like a tobacco company in the near future -- meaning volume declines combined with price increases -- it isn't the end of the world. Tobacco stocks have been some of the best-performing stocks of all time as investors continually underrated their ability to raise prices ahead of inflation.

The same could play out for PepsiCo, especially if the company's snack foods become more of an occasional treat instead of a daily consumption habit. With a dividend yield of 3%, now looks like a fine entry point for investors looking to buy a dividend grower at a reasonable price.

Still, investors need to pay close attention to PepsiCo's volume declines. Weight-loss drugs could be an overrated threat, but the declines could also be the canary in the coal mine for the future of the soda and snack food sector. Pepsi stock looks undervalued, but it would be unwise for investors to fly blind with this company.