His diplomatic immunity will lapse once he's no longer the head of state however.
EDIT: Pretty sure that they are personas-non-grata in each other's country at this point, which is a specifically described scenario in the Vienna Convention on Diplomatic Relations.
So no, of course Zelensky couldn't enter Russia and expect nothing to happen. An Putin couldn't enter Ukraine with the expectation that his immunity will hold.
But both of them could enter any 3rd country with a reasonable expectation of that.