You can use a basic "differential amplifier" ro compare the voltages on live and neutral.
eg.
https://www.electronicshub.org/wp-content/uploads/2015/01/1.-Differential-amplifier-circuit.jpg
R1 and R2 must be equal; R3 and R4 must be equal.
The ratio of the
input resistors to the feedback & ground resistors sets the gain.
[Edit - added italicised part, missed from the original answer]
You would need to add diodes (eg. 1N4148) to limit the voltage on the opamp inputs, so no damage occurs if full mains supply voltage is present.
Values such as 100K for R1 & R2 with 1M for R3 and R4 would give 10x gain at the output. You need a high impedance input opamp, preferably a low offset type.
The "ground" is the zero reference for the rest of the circuit. eg. If you use a +/-15V supply, it is supply 0V (which would also be electrical ground).
If you use a single polarity, eg. +24V, use a voltage divider to give half supply, plus another opamp connected to that as a voltage follower. The opamp output is the zero reference for the analog circuitry. (And the PSU )v would be electrical ground).
See the left half of this image:
You can use another gain stage after the differential amp, if you want a higher voltage before rectification. That should be AC coupled as any DC offset is irrelevant and could cause problems. A high frequency cut filter may also help, either before or after the differential amp.
Then an active full wave rectifier; example:
The connections shown as ground connect to the reference zero, of whichever type that is.
What you do the voltage from that point is up to you...