You can try erasing the phone through iTunes: Use iTunes to restore your iPhone, iPad, or iPod to factory settings - Apple Support
If the screen is locked, try putting it in recovery mode. Turn off your device and leave it off. Plug in your device's USB cable to a computer with iTunes. Hold down the Home button on your device as you connect the USB cable. Keep holding down the Home button until you see the Connect to iTunes screen. When you see this screen, release the Home button. If you don't see this screen, try steps 1 through 3 again. When your device is connected, iTunes will open. You'll see a message saying that iTunes has detected an iPhone, iPad, or iPod touch in recovery mode. Use iTunes to restore your device.