The SIM card only holds your number and carrier settings. It does not hold any data from the iPhone itself whatsoever.
What makes you think the device itself has been compromised?
No, replacing the SIM card will not do anything in regards to a compromised iPhone. However, do note that unless the iPhone is jailbroken there is no known method of remotely hacking an iPhone.
The Apple ID may have been compromised, but that has nothing to do with the device itself. If you believe your Apple ID has been accessed, then change your password for it and engage 2 Factor Authentication if it's not already on. Link-> If you think your Apple ID has been compromised - Apple Support
Perhaps if you explain what makes you think its been compromised, someone can provide some help to resolve it.