Sorry for the comedic fluff in between but the question and possible scenarios just invoked some images...
Short answer
Given you are an average bloke without much experience in martial arts, you should make contact with your shin or, for close range, your knee or thigh in an upward direction. Add some distraction in form of an upper-body movement as an opener to cover what you are about to do. Squeezing with your hand is a thing of manga and fantasy in any normal fighting situation (except sometimes on the ground, see comment section), and hitting with a punch requires a change of level and accuracy that cannot be expected.
Long answer
Why and how to kick?
Given your opponent is stupid enough to have an open stance with his front turned towards you, a kick to the groin is the easiest thing in the world: Raise your leg. From farther away, a soccer kick (high kick to and with the ball(s)) is good enough: It is fast, it can barely miss as the inner thighs lead the way, and everybody can reach this height regardless of flexibility. I would recommend hitting with the shin as the chance to miss or hurt yourself when hitting with the toes or instep is just too high. When in close range, you raise your knee as fast as possible, and that's about it. It does not matter much whether you connect with your actual knee or your thigh, your opponent will appear to grow some inches before they welcome the floor.
Trying to hit the groins with a teep kick or the heel from the front is not advisable for two reasons: Firstly, it needs a good amount of accuracy and technique to do so properly and secondly, the balls are hanging freely, so hurting them from the front does not make much sense and hitting them so that they get squeezed (which is the main reason for pain) is not a trivial thing to do from there. You can still connect in the general pubis area (this hurts women just as well, btw, just like the groin kicks described in the last paragraph) but if you have a good teep kick, you aim for the bladder as the pain there can be just as excruciating but it aligns better with the direction of force.
In any case, you should set it up with some jab or boo or whatever to set the attention to your upper body. That way, you make sure that they don't see it coming and instinctively defend against the hit.
Why not punch?
The first reason is the same as in my last paragraph: The amount of accuracy and technique needed, as well as the direction of force, just make it lose viability. If anything, a hook punch from behind and below (connecting with your biceps) makes sense.
This leads us to the second reason: if you want to punch from the front, you would have to change levels by squatting or going on your knees (I advise against jumping into a full split) in order to have the correct direction of force and this leaves you vulnerable to knees from your opponent connecting directly with your head.
If it is so easy and intuitive, why don't we see many more groin kicks?
Because of the premise I made in the very first sentence (of the long answer): This depends on an open stance. As soon as your opponent has a lead leg and is tilted away, it becomes exponentially harder to hit the groins.
Also, depending on the legislature of the place you are in, it can cause legal problems as a groin kick is a pretty harsh escalation of violence with potentially life-long consequences (infertility).