“Magic or sorcery” is what we call certain anthropological practices. We know, for a fact, that plenty of people “cast spells” and do other such things.
Now, that is not to say that magic “works”. Almost certainly, the actions they perform have no efficacious power in themselves, so they do not “work”.
However, Jesus, Truth Himself, said that demons are real, and do real things. Demons are deceivers.
One real thing they may do is to make it look as if magic “works”, and gives humans the powers of a little God. They may voluntarily appear to serve humans, make contracts with humans, or be overpowered by spells, simply to toy with such would-be sorcerors and harm their souls. It’s the same sort of way they try to fool other humans into believing in false gods or false psychic powers, or just false ideas about life.
Magic and divination has always been forbidden, both by the Jews and the Church, under the same reasoning as idolatry. Occasionally you see some sort of confusion about occult practices where people claim they are ordinary ways of seeking knowledge or prayer to God; contrariwise, you see people taking perfectly good prayer practices and turning them into stupid magical spell stuff.
Basically, though, we have no business fiddling around with anything seriously claiming to be real and efficacious magic.