GPS is not the only way to know where you are.
Turn Location Services and GPS on or off on your iPhone, iPad, or iPod touch - Apple Support
iOS devices might use Wi-Fi and Bluetooth to determine your location. GPS and cellular location are available on iPhone and iPad (Wi-Fi + Cellular) models.
Other than trying to do a reset to factory settings I am not sure how best to find out if the GPS not working is software or hardware. I would recommend taking a backup with iTunes:
How to back up your iPhone, iPad, and iPod touch - Apple Support
Then:
Restore your iPhone, iPad, or iPod to factory settings - Apple Support
And set it up as new, and confirm if the GPS still does not work. if it does not work then it is hardware. And to get that fixed you will need to:
Contact Apple for support and service - Apple Support