When Carrie Davis found out that her health insurance wouldn’t cover Ozempic, she sought an alternate route to getting the diabetes drug, which is increasingly being used off-label for weight loss. Ms. Davis, 55, did not have diabetes, but had gained 50 pounds during menopause and developed hypothyroidism, she said, and was eager to lose weight.

After seeing someone claiming to be a doctor on TikTok saying he could help patients obtain a generic version of the medication, she reached out. After a few days and a brief video consultation with someone who introduced herself as a nurse practitioner, Ms. Davis had a prescription in hand. “It was really fast,” Ms. Davis said.

It took a week for the medication to arrive — a vial filled with a mauve liquid that was semaglutide, the doctor said, the same active ingredient as in Ozempic. She was told to inject it weekly, just as people who take Ozempic do. But her medication had been shipped to her home in Galveston, Texas, from a compounding pharmacy in Kentucky.

In the scramble to find Ozempic, patients are seeking out telehealth platforms, medical spas and compounding pharmacies for what some tout as “generic” versions of the drug. But Novo Nordisk, the company that makes Ozempic, does not sell semaglutide for compounding purposes, and a generic form of the drug approved by the Food and Drug Administration doesn’t exist, a Novo Nordisk representative wrote in a statement.

There are roughly 7,500 compounding pharmacies in the United States, according to the American Pharmacists Association. Compounding involves mixing and altering drugs, customizing them for patients with specific needs — for example, someone who is allergic to an ingredient in a medication might require a reformulated version.

Because the F.D.A.’s drug shortage website lists as Ozempic as “currently in shortage,” compounding pharmacies are allowed to buy semaglutide from pharmaceutical ingredient manufacturers and compound it into an injectable medication they dispense. They also often mix it with B vitamins or a metabolic compound called L-carnitine, which limited research has shown may contribute to weight loss. Some compounding pharmacies are distributing a different active ingredient altogether: semaglutide sodium, the salt form of semaglutide.

In recent weeks, regulators have raised concerns about semaglutide sodium, which is sometimes sold as a research chemical. Semaglutide sodium does not appear to meet standards for compounding in federal law, in part because the substance is not part of any F.D.A.-approved medication — and officials have expressed alarm at how widespread it is.

The F.D.A. does not vet compounded medications, and has not reviewed, approved or tested — for safety or effectiveness — the semaglutide drugs compounding pharmacies offer. Compounded semaglutide poses a higher risk to patients, as any compounded drug would, a representative from the agency said.

“There are a lot of great compounding pharmacies out there that take great patient care every single day,” said Betty Jones, compliance senior manager of accreditation and inspection programs at the National Association of Boards of Pharmacy. “But there are some of those bad actors.”

At the end of April, the F.D.A. sent a letter to the National Association of Boards of Pharmacy, saying the agency was aware that compounders might be using salt forms of semaglutide. “We are not aware of any basis for compounding a drug using these semaglutide salts that would meet federal law requirements,” the letter read.

Functionally, when semaglutide sodium is dissolved in water, the sodium ion separates from the semaglutide molecule, leaving semaglutide and an extremely small amount of sodium, said Scott Brunner, the chief executive of the Alliance for Pharmacy Compounding. But there isn’t data demonstrating whether semaglutide sodium is safe for consumers, or even whether it’s effective, said Mary-Haston Vest, system director of pharmacy with UNC Health.

In response to mounting questions about compounded semaglutide, the North Carolina Board of Pharmacy issued a statement forbidding compounding pharmacies to use salt forms of semaglutide. The West Virginia Board of Pharmacy issued its own warning on the topic. The Mississippi Board of Pharmacy also released a similar warning, writing that “drug manufacturers have become aware of the practice of using semaglutide salts for compounding and may choose to initiate legal proceedings to combat this practice.”

A representative from Novo Nordisk said the company is taking action, including but not limited to issuing cease-and-desist letters, against “entities that are engaging in the unlawful sale of compounded semaglutide, disseminating false advertising, and infringing its trademarks.”

“It’s a scary area,” said Dr. Andrew Kraftson, a clinical associate professor in the division of metabolism, endocrinology and diabetes at Michigan Medicine at the University of Michigan. “And I think it’s only going to get more thorny.”

Compounding pharmacies are attempting to fill a crucial hole in the market, said Tenille Davis, a compounding pharmacist in Arizona. “They’re not trying to make a million bucks doing this. They’re trying to meet an intense, overwhelming patient and provider demand for this product.”

There are some guardrails in place. Under federal law, compounding pharmacies can compound drug products only with active ingredients that come from facilities registered with the F.D.A., Mr. Brunner said. And state boards of pharmacy license and inspect compounding pharmacies; the F.D.A. also inspects compounding pharmacies that it believes pose a safety risk. “The fact that it’s not F.D.A.-approved doesn’t automatically mean that it’s not safe,” Mr. Brunner said.

But it’s not clear how the vitamins or other additives pharmacies mix with semaglutide might interact, and compounding pharmacies are largely making “educated guesses” about how safe these combinations are, said Robin Bogner, a professor at the University of Connecticut School of Pharmacy and an expert on compounding. “While there are not known interactions,” Dr. Vest said, “this does not necessarily mean no interactions exist.”

Ms. Davis did not appear to have a negative reaction to the drugs she received, but she did switch to a different source for getting compounded semaglutide: a weight loss clinic that gets its medications from a local compounding pharmacy. The clinic required blood work, in-person appointments and stricter oversight than the doctor she found on TikTok had provided, she said, measures that made her feel more comfortable as a patient; the clinic also costs less. Both compounded drugs seemed to work, she said.

Some websites sell what they claim is semaglutide directly to consumers — no prescription, no oversight, just vials of the chemical, with wording on the label that the semaglutide is only meant for “research use.” There’s a critical difference between those sites and compounding pharmacies, Mr. Brunner said. The National Association of Boards of Pharmacy maintains a list of websites that sell fraudulent and unsafe medications, and patients should consider crosschecking to make sure they are not getting semaglutide through one of those channels, said Bill Cover, the associate executive director of state pharmacy affairs at the National Association of Boards of Pharmacy. And be wary of telehealth services that offer compounded semaglutide without a prescription or any input from a licensed doctor, Mr. Cover added. “If it’s too good to be true, it could potentially be a big red flag,” he said.