Yes, hackers can track your iPhone if they’ve installed spyware on it. If you tend to give apps permission to access your location, then it’s possible for a hacker to track you. Make sure you only give location access to apps that actually need it, such as Google Maps.