Based on your wiring color and photo, I'm going to assume this is an older house in the US.
First a few things. Sometimes there are wires in a box that just pass through and go somewhere else, so all the wires might not be used by the switches or outlets in a given box. It's not unusual to have 5 wires in a switch box.
Also, the ground wire is there for safety. Lights and appliances don't really "use" the ground, and ideally it should never carry any current. All ground wires in boxes and fixtures just get connected to each other like a safety net that catches and stray electricity and makes sure it gets back to the main breaker box (to hopefully trip a breaker in a dangerous situation). Older wiring practices didn't always use the ground, but now almost everything is connected to ground including light switches.
So, for the new switch, hook up the same two wires that go to the old switch and then you will need to "pigtail" the ground and connect it as well. A pigtail is a short wire that runs from a bundle of wires and connects to a device. So, it's not a matter of "which" ground wire - it's both.