If you ever socket a gem into a piece of equipment by mistake, or want to swap it for another one, you can always remove it safely with the help of Jeweler's Pincers of relevant quality (which depends on the gem's rarity):

1. Click the arrow icon on the gem:

2. you will be able to buy and use (or just use if you already have one) a relevant item in the menu that pops up next:


It is not possible though to safely remove an enchantment. You have to delete it altogether should you want to insert a new one:

1. Hover your mouse over a socketed enchantment, then click the "X" icon:

2. Confirm the deletion: