You can indeed remove a marketplace module by right clicking on it and deleting. But if you want to check if there are unforeseen consequences you should check if the module is being used by → right click on module → find usages of this module. If there are none then it is probably okay, but please note that it may not give warnings in case you’ve used it in java actions.
Also, deleting a module will not remove the userlib imported.
Hope this helps!