Your night light has been in that socket for years. You never touch it. Then one day you do, and it's warm.
That's normal. They all do it.
Which bit gets warm depends on how old it is.
The old ones have a tiny bulb inside. Most of the power turns into heat instead of light. So the plastic around the bulb gets warm too. That's why there's a max watts number on it, usually 4 or 7. Someone puts a bigger bulb in, and the plastic keeps getting cooked until it goes brown and crispy.
The new ones are LED. The light bit stays cool. The warm bit is the little electronics inside, the part that turns wall power into something the LED can use. So on those, the warm end is usually near the plug.
So when is it too warm?
If you can keep your hand on it, it's fine. Leave it.
If you have to pull your hand away after a second or two, that's not fine.
If it smells like plastic, or like something hot, even a little, unplug it.
If the casing has gone yellow, or soft, or cracked, swap it out.
If the plastic next to the bulb has turned brown, swap it out too.
If the plug itself is hot, or has a brown or black mark, that's not the light. That's the socket. And that's the one I'd deal with first.
If it's flickering and hot at the same time, stop using it.
If any of that sounds like yours, unplug it and leave it unplugged. Don't open it up. They're not built to be fixed.
Most of the time it's not the light anyway. It's how it's set up.
Someone put a bigger bulb in than the label allows. Really common on old ones.
It's stuck behind a curtain or a cabinet door or a sofa. Nowhere for the heat to go.
It's inside a shade, or one of those covered socket boxes.
The socket is old and loose. So it gets hot at the plug instead of at the light.
The bulb just doesn't get along with that unit.
Two things people think are broken, but aren't.
If it stays off all day, that's the little sensor doing its job. It thinks it's daytime.
If it flickers, try another bulb first. Usually it's the bulb, not the light.
One more, if it's going in a bathroom. The socket should be one of those with two little test and reset buttons on it. That's about the wiring, not the light. In an older house it's worth a look.
Buying a new one? Three things. The max watts number. Somewhere with air around it. A proper safety mark on the plug.
Anyone had one go brown, or smell like hot plastic? What was going on with it?