Eating late at night, close to bedtime, will do several things.
It will disrupt your sleep. Even if you fall asleep, it won’t be the deepest possible sleep.
It will interrupt weight loss (if you’re in a weight loss phase) and/or cause weight gain.
You don’t want your digestive system working overtime all night long.
About three hours before bedtime, for most people, is a good time to be finished eating.