I've actually witnessed a couple accidents where pedestrians were hit by a car within the past year so I have a little experience of this. Things go a lot better if you can keep yourself calm and take things step by step. If you keep your wits about you, you actually can do a lot of good for the person that got hit.
First, assess the situation. How bad is the accident? How hurt are they? If it's serious, call 9-1-1 immediately and report it. If you're the first person to call in, they'll likely have you go talk to the person who got it and tell them to stay on the ground. Reassure the person that help is on the way and give the best description of your location. They'll tell you to do this on the phone, but it's easier if you're mentally prepared for it. The person might be confused. In one of the accidents I witnessed, a guy got hit by a car and the driver backed over his legs trying to escape. After regaining consciousness, the victim didn't even know he'd been hit by a car and tried to get up even though he had two broken legs. If you're not there to talk to them, they might do something to make their injuries worse.
If it's less serious, try and get the license plate, make and model of the vehicle involved in the accident before calling 9-1-1. Do this even if the driver doesn't leave. You never know if they'll bail when they hear sirens. If the victim is going to have any chance at suing, they'll need this information. If it's a serious accident do this step after calling 9-1-1 while you're talking to the victim. It might not be possible to get this information but it's helpful if you do have it.
If you have to block traffic, do it. People might be annoyed but the safety of the person lying on the ground trumps other driver's needs to get where they're going quickly. You should never move someone who can't move on their volition and it's probably a bad idea to let someone who's been laid out by an accident get up and walk away. It's actually possible to break your neck without knowing it so the act of getting up off the pavement can cause paralysis.
While the EMTs/police show up, start rehearsing the story of what happened in your head. You're gonna want to make the best statement you can because it helps all parties involved. You're gonna be asked your story multiple times. If it's a bad accident, you're likely going to be called by insurance companies down the line trying to trip you up or try and twist your statement towards their side.