I have a road bike and a CX/winter road bike (and mtbs too, obviously!)
In the summer when the roads are dry, the road bike is lovely but I honestly don’t think it’s significantly faster than the CX bike with the stem flipped and decent road tyres on.
As a bike though, my CX is fantastic and possibly my favourite – CX bikes are absolutely brilliant for mixing up road and offroad that would probably be a bit tame for mtbs (or sometimes not 🙂 ).
In short though, a CX with road tyres and a position that isn’t silly high at the front will be fine on the road – if you’re significantly slower than people on ‘proper’ road bikes then that’ll be down to your legs, not the bike.
FWIW, compact 50/34 and 11-28 will be fine for CX and road riding unless you’re doing lots of 30+ mph timetrials 🙂