Caffeine doesn't actually do any of the things sleep does to your brain. If you drink coffee during a late night, you won't feel as tired, but your brain performs worse, your reflexes are slower, you're less likely to remember things, etc. It's like painting over a rusted car instead of properly maintaining it, basically.