Yes a cop can stop you while you're walking and if the cop wants to stop you while walking and demands that you stop then you must comply.
If you don't stop for the police when you're walking then you can be arrested and charged with fleeing the cop.
If you're not doing anything illegal then just stop as the cop may be looking for someone that fits your description and if you're not the one then they will just let you go and you can be on your way.
A few years ago I was walking down the road just getting some exercise and there was someone that the police were looking for.
The police turned on their lights and bumped the siren and told me through the PA system to stop.
So I stopped and the cop came over and said that he was stopping me because I fit the description of a person they were looking for.
He was right I was nearly a look alike to the person they were looking for but I showed my ID and they let me go.
I'm glad the cop was doing his job and I gladly comply.
The person had robbed a store and killed a worker in the process and eventually the same day they caught him.
I had nothing to hide.