I have an HP Envy 5030, and printing from Ubuntu (22.04, but also earlier versions) works fine, both via Windows Shared Printer and directly via USB.
Scanning, however, has always been a problem, as Ubuntu’s Document Scanner always crashed with the message
simple-scan crashed with SIGSEGV in _IO_new_fclose()
Scanning from the HP Device Manager also starts Document Scanner, so that’s option, and running hp-uiscan can’t find the scanner (“No device connected”).
Search through online forums, I found mention of XSane, and searching for XSane I found the Ubuntu page on XSane, stating
XSane can also be used from within The GIMP; just click
File > Acquire > XSane
to scan directly into an image.
Let’s give it a try.
According to the Man page of the Sane project, xscanimage will be used as a plug-in for Gimp.
$ xsane
Command 'xsane' not found, but can be installed with:
sudo apt install xsane
$ xscanimage
Command 'xscanimage' not found, but can be installed with:
sudo apt install sane
Installing…
$ sudo apt install xsane
$ sudo apt install sane
and linking the plug-in…
$ ln -s /usr/bin/xscanimage ~/.gimp-2.8/plug-ins/
I find various scanning options in the Gimp’s Plug-In Browser:

From Gimp’s menu, you can now find those connections under File > Create > xscanimage >
I finally managed to scan 1 image, but unfortunately, subsequent scans failed with the dialog message
Failed to open device `….’: Error during device I/O.
Printing still worked, though. Still, the issue bugged me.
I found various mentions of airscan-discover, but couldn’t figure out what it would do, so I ran the tool
$ airscan-discover
[devices]
HP ENVY 5000 series [FD1005] (USB) = http://127.0.0.1:60000/eSCL/, eSCL
and added the line in the [devices] section of airscan.conf, as described here.
$ sudo nano /etc/sane.d/airscan.conf
Then I started
$ simple-scan "airscan:e0:ENVY 5000"
and it scanned!
And then I started Gimp and selected File > Create > xscanimage > airdrop:...
and it scanned!