The basis for this mitzvah is that sorcery is a pox on society and that many people are misled by its practitioners. It says nothing as to whether or not sorcery is efficacious. One can mislead others by pretending to have supernatural powers without it actually being true.
The question of whether or not magic exists (or ever existed) is far beyond our scope. Suffice it to say that there are different opinions on the matter. It’s possible that even Biblical descriptions of sorcery, such as the acts of the wizards of Egypt or the divination of the witch of Endor, were mere parlor tricks and sleight of hand. Even if we accept those Biblical examples as bona fide magicians, it’s a pretty safe bet that there’s no such thing as witchcraft today. Nevertheless, that does not permit one to deceive others with séances and tarot cards. But let’s not get ahead of ourselves. The mitzvos prohibiting us from practicing sorcery will be found later, in parshas Shoftim (Mitzvos #510-515). Here, we speak of the court’s obligation to judge such cases and not to overlook the actions of such charlatans.
Though the verse speaks of a sorceress, the context is not gender-specific. The Torah merely speaks in the normal way of things and witches were more common than wizards. (This was presumably true in Pilgrim days and it is true in modern Wicca, as well.)
This mitzvah only applies to an ordained court of 23 judges, in Israel. Unlike most mitzvos on the court, such as the obligation to judge this kind of case or the obligation to impose that kind of penalty, this mitzvah is phrased in such a way to make it a prohibition rather than a mandate. (Violating a prohibition is generally more severe than failing to fulfill a mandate.) The prohibition against releasing a convicted sorcerer is discussed in the Talmudic tractate of Sanhedrin on pages 67a-b. It is codified in the Mishneh Torah in the 14th chapter of Hilchos Sanhedrin and is #310 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.