Surely some of us may have had relatives who pass and we try to figure out what accounts they have, and i even had some relatives tell me that they want me to know their passwords in case something happens to them, and my most common response is that they need to keep their passwords in a safe place that would be accessible upon their passing, which surely is easier said than done... and most likely value ends up getting lost when persons pass and so many passwords that they are not even able to keep track of.
Encryption can help with that kind of thing. Ideally they would hand off to you an encrypted file to you with a password that you would be unable to access (easily) until after their passing. That can be a bit tricky and depend a lot on the level of trust between you so would have to be decided on a case-by-case basis. Also make sure that the password could not be accidentally lost.