When you say "run up", do you mean that literally (as in: letting go of shield, then dashing or walking forwards into something)? If so: that's too slow to successfully punish with in most situations. Often you will punish a shielded smash attack with a shieldgrab (if in range), an aerial out of shield (e.g. Falcon stomp, Marth fair, Sheik nair), or a wavedash into something (e.g. grab, shine, Samus down smash).
The opponent can sometimes get out a second attack to hit you as you try to punish them after avoiding something else; depending on the attack used, how soon you start to move in, and how you avoided it (dashing away, shielding, etc.). Sometimes this is just because you're too slow, and therefore you are actually able to punish them before they have a chance to do anything simply by acting sooner or using a faster punish option. Sometimes their first action forces you into a mixup situation, making it so that you have to read what they're going to cover themselves with and act accordingly. For example: when a Sheik does a forward aerial on your shield, they can choose to (amongst other things) down smash immediately after they land; if you try to shieldgrab after the fair, then the down smash will hit you out of your grab (since you'd no longer be shielding), but if you wait for the down smash then they end up doing a laggy move on shield that you can punish (with a shieldgrab, etc.).
Staying with the Sheik forward aerial on shield example: there are many options that the Sheik can mix the down smash up with, which all have different rewards and counterplay (some overlap, some do not; meaning that sometimes covering one option will leave you open to others and vice versa). One of these is grabbing after the fair instead of down smashing, which beats staying in shield; meaning that if you wait in shield so you can beat the down smash then you leave yourself open to the grab. You can roll after the fair to avoid both the grab and the down smash, but then if the Sheik waits for the roll they can react and cover it (with a dash attack, etc.). Rolling also affects and is affected by your stage positioning (as are the other options, but rolling especially so), which adds more factors to consider..
Mixup situations can get very complex because there can be many possible options for both players to choose, and the risk/reward and the likelihood of a given option being chosen can vary depending on a large amount of factors (stage position, option coverage, habits/preference, mental state of the players, etc.).
You'll learn what things are safe to punish and what things are unsafe or potentially unsafe though experience; it will come with playing the game, and with watching it, and with actively thinking about it (which can be done when watching or when playing).