Cocaine and methylphenidate are thought to likely be inverse agonists at DAT, meaning they will still be increasing dopamine in the synaptic cleft a fair bit which generates oxidative stress (not good for neurons). Stimulantion/stress can also be bad for brain cells, and sleep deprivation can certainly be unhelpful for brain health as well. So I certainly wouldn't consider either one safe in terms of the brain if abused.
Drugs of abuse seem to be able to exert deleterious effects on the brain that may have more to do with the pathology of addiction than a direct neurotoxic effect of the drugs, see for example orbitofrontal cortex atrophy/dysfunction in ex-cocaine users.
Stay safe,
CY