Be very careful purchasing a used Mac from unknown sellers. If you have to ask if it is safe, then assume it is a bad idea.
If a Mac has a firmware lock enabled, then you will never be able to remove it because you won't have the necessary proof of purchase to have Apple remove the firmware lock.
Many Macs these days are being managed by schools and businesses (MDM). If a Mac is not properly removed from the MDM, then the previous owner is still able to control the Mac and lock it remotely including installing their own software. There is no way for you to remove or disable this either except to hope the previous owner will do it for you if you contact them (assuming the Mac was meant to be sold in the first place and is not stolen).
It is very easy to detect a firmware lock when you receive the Mac (Option Boot the Mac to see if the padlock appears), but it is sometimes much more difficult to detect if the Mac is still being managed by the previous owner. Usually you will see the management notification screen during setup of a new OS, but this does not always happen depending on how the MDM configures the Mac or if the PRAM has been reset. Sometimes it may take days or even weeks before a notification may appear while you are using the Mac.
Make sure you are willing to accept these risks, otherwise only purchase a used Mac from a reputable refurbisher (even they make mistakes, but you may be able to get your money back) or directly from Apple.