If the printer provides it’s own print server, which should be the majority these days, it’s probably easiest to just use that from both Windows and Linux. Failing that, you can set up your Ubuntu machine as the print server: https://help.ubuntu.com/community/NetworkPrintingWithUbuntu
You may try sharing your printer using cups web interface at http://localhost:631
Switch to admin tab (login with local sudo user if necessary) and visit server section.
I didn´t do this myself (and can´t try because I do not have a printer available). Just asked google ai prompt “linux share local printer with network”.