Is 31v too much for a Ring doorbell calling for 24v?
With No Load, a transformer will have a higher nominal output voltage.
I am assuming these are the wires from your old doorbell system.  Try pressing and holding an existing doorbell button and measuring the voltage with the doorbell active.  That should give you peace of mind.
I believe you'll be fine.
(Or your voltmeter could be off!)