Every email I have seen making such a claim has been a scam. Who would be sending you an email saying you have been hacked and what would the purpose be? Do not respond or call any provided numbers.
As always, if you think your account has been compromised, change your Password and review this support article.
If you think your Apple ID has been compromised - Apple Support
To review if anyone else is logged into your account and also see what info you are sharing, run Safety Check.
How Safety Check on iPhone works to keep you safe - Apple Support