I had a close relative recently pass away and we have not been able to access their phone. I have all the account information (iCloud email and password). When I try to login online it makes me want to enter a verification code from the phone but I can’t enter it because we can’t open the phone. I have also tried using I forgot.apple.com and did not have any luck. Does anyone have any other suggestions, anything would be greatly appreciated?
That’s security working as intended, so anyone just can’t gain access even if they know your password ie 2FA.
You need to go through Apple to gain access to the account, along with supporting death certificate, court documents, etc.
https://support.apple.com/en-us/HT208510
And that’s access to their iCloud/Appleid account. If you don’t have the passcode, you won’t be able to access the phone, but backups might exist on iCloud that you can restore from, plus whatever else you can access directly with an iCloud login.