It really depends on the nature of your world. If it's a real-world style planet, looks like Ruin Explorer has you covered. But are there other factors at play in a D&D planet? Might there be magic capable of helping people live long term without a Sun? Or might the world's heat simply not come (only) from the Sun? Perhaps the Sun simply isn't necessary for the world to keep turning- maybe enough food can be harvested from fungus-based ecosystems (e.g. the Underdark) to keep things going, or people can quickly adapt to farm fungal food sources.
And that doesn't even address the non-planetary options. My campaign setting is set on the inside surface of an enormous bubble of water, and the Sun is an artificial object that orbits a specific island at a distance of half a million miles. It provides significant light and heat, but people survived before it existed, so it would be possible to go on after it was gone.
Anyway, I think the consequences in most settings would be grave. I suspect that most of the survivors would tend to be in larger cities, where higher level individuals and more magical resources are likely more available. Which leads to interesting knock on effects- if the outlying places tend to die out, and those are usually where the urban centers get their food, do the cities survive, or do they just die slower?
Which brings up one more element: time. The effects will be scary but not lethal in the first few days, but escalate over time. What percentage of the population dies depends on how long the Sun has been dead for.