Always repeat it back to them. "oh hi Steve, nice to meet you".
Still never manage to remember
By the time they finish saying their name I’ve already forgotten, I always wonder if they can see it on my face while shaking hands
That's why I don't say my name, I just say hi. They won't remember it anyway. What a strange social construct to say your name to strangers who don't care and will have forgotten it and everybody else's in 5 seconds anyway.
I have problem to remember their faces too. Except cute girl, i remember their name, face and phone numbers in a minute.
*on an orgy
Speak out the name aloud. Then make up a scenario in your head where you tell someone the name of that person.
The trick that works for me: i associate that person with someone i know with the same name, for example, if i meet a Mark and i have a friend called Mark i just link the 2 together, never failed me