Sometimes you can hard reset an Android smartphone if you have forgotten your PIN password and then regain control of it after the reset. The Moto G is one device you can hard reset when it’s locked. If you were to do that, you would need to take the hard reset via Recovery Mode by booting into Recovery using the hardware buttons.
However, as you are probably aware if you’re here, many Samsung smartphones now come with Factory Reset Protection (FRP) which prevents you from being able to hard reset via Recovery to regain control; now you need to still know your password when you hard reset via Recovery.
Thankfully, not all hope is lost. When needing to get past FRP, you want to look for FRP Bypass tools. We don’t share FRP Bypass Lock tools anymore because they may be illegal. But we know that they’re out there and exist. One that used to be reliable was FRP Hijacker, but it’s an aging tool now, so I’m not sure how reliable it is now. And you can probably find many good ones from Google Search.