I'm not sure which anime you're referring to. But if you're talking about an anime where the main character dies and goes to another world, then it might be Death Note or Death March. Both of these works were adapted from novels of the same name, in which the main characters would enter another world after death. If you have more information, I can better answer your questions.