Pin 5 of OBDII is the digital ground. Pin 4 is the chassis ground. You seem to realize this. So, I’m just clarifying.
Now, the question is, will it work if you hook both to the chassis ground of the car? Well, yes, probably. In a car the entire chassis is usually connected directly to the 12V negative lead. So, connecting to chassis ground is essentially equivalent to connecting to the ground of the car. You could also connect both to a digital ground wire. That would work too. The correct approach is to connect OBDII pin 4 to the chassis ground and pin 5 to a digital ground.
Now, the deeper question is, what is the difference? The car chassis is ground, digital ground wires must also eventually make their way to the 12v negative terminal somehow. But, there is a difference. Dedicated wires can potentially pick up less “chatter” as they haven’t got as many things connected to them. The chassis in a car is quite noisy. In an internal combustion engine car you’ve got Tesla coils connected to spark plugs. They’re noisy. In an electric car you’ve got potentially 1000A of current getting switched on/off 10,000 times per second. Either way, the chassis of the car could be a noisy place. Dedicated wiring can be insulated from this a little bit better. In a general sense, from a high overview, the chassis and dedicated digital wiring is equivalent. From a closer, more technical perspective they’re a little bit different. If you can help it it certainly doesn’t hurt to do it properly.
But, you’ll probably be OK with any of the three options - connect both to chassis, connect both to digital ground, connect them separately.