Thank you for the information.
Many HP ENVY 50xx All-In-One Printer models are listed in About AirPrint - Apple Support. This means that the model in question should be compatible with macOS 14 Sonoma without the need for an additional driver, provided that the printer and the Mac computer are connected to the same network (Wi-Fi router).
If necessary, if there is a problem with AirPrint device discovery, try a full power-cycle sequence (including the router): Power off the Wi-Fi router, the HP printer, the Mac, and all other devices/computers. Wait two to three minutes. Power on the router. Wait two to three minutes. Power on the HP printer. Wait a minute or two. Power on the Mac. Finally, power on all other devices/computers.
Check that you have the latest printer firmware.
Reset the printing system on your Mac to solve a problem – Apple Support (UK)
Add a printer to your printer list so you can use it on Mac – Apple Support (UK)
https://support.hp.com/us-en/product/product-specs/hp-envy-5000-all-in-one-printer-series/14095644