A concrete example of how this works in practice, because the abstraction is confusing.
Take a substance that is a pharmacy medicine in country A, a food supplement in country B, and a prescription medicine in country C. Same molecule, same dose, three legal categories. A pharmacy in A selling it to a customer in B is a lawful supplement sale. The same pharmacy selling the same box to a customer in C is unlicensed supply of a prescription medicine.
Neither the pharmacy nor the box changed. The destination did. This is why “is this safe” and “is this legal” are different questions and why the answer to the second one has a postcode in it.
Phenibut is the textbook case of this and the one everybody argues about.
Peptides are worse. Almost none of them have a harmonised category anywhere, so the same vial is a supplement, a medicine, or an unregulated research chemical depending on which border it crosses.