I've visited Herculaneum recently (2 weeks ago) but had to skip Pompeii on this trip because the heat was too intense. If you are going in late July then prepare for immense, inescapable, baking heat. Bring a sun-reflecting parasol, it helped me significantly in many places like the Roman Forum and Herculaneum. A portable fan is a must as well. I personally would not go in July at all, but you may be able to tolerate heat better if you're from a warmer climate (I am British).
Herculaneum was incredible, on a much smaller and more condensed scale than Pompeii, and a completely different experience. This was my first time and I didn't get a guide because I thought I could rely on the self-guided app, but it was unusable (can't use it and take photos at the same time, map wouldn't download, relies on consistent WiFi or mobile connection which was spotty). I hung around close to a small tour group and became friendly with them so I got some information from their guide which I wouldn't have otherwise. I would definitely suggest booking with a guide in advance, they will usually sort your ticket for you. I'm pretty sure that one I unofficially joined was called Askos Tours.
As for Pompeii and Herculaneum in one day - I feel comfortable saying that you should absolutely do not do this. Especially if you are not staying any closer than Napoli. There are a number of tours through Viator/Get Your Guide/etc. which will do both in a day, but what you get is a crappy, exhausting experience at both where you are rushed through the major checklist sites and then packed back into a bus for 7+ hours of driving total. Pompeii is absolutely immense, and I've seen so many people underestimate how much time it takes to see even a fraction of. 3-4 hours is considered a minimum visit.
If I were in your position, coming from Rome, I would take a fast train to Naples and then get a small group tour or a private taxi from there. Tours which originate in Rome will spend 2.5-3 hours (each way) on a bus driving from Rome to Naples, when you can just take Frecciarossa in about 1hr15m. The circumvesuviana (commuter train) is pretty dire, frequently late, hot, crowded, and chaotic. I found it very worth avoiding by using a private driver in an air-conditioned vehicle.
But my honest overall opinion which you may not want to hear is this - If this is your first time in Rome, with 4 nights total, I would spend it all in Rome. Pompeii and Herculaneum are both amazing and worth seeing, but they are not close. July heat is often unbearable.
Just my personal opinion! Best of luck and I hope you have a wonderful visit.