Worth noting that JPEG XL has a pretty good lossless mode too, however, I think in many cases you actually want to just use a lossy AVIF or JPEG XL in places you'd previously have used "lossless".
It was kind of an artificial split, much like text, alpha transparency or line drawing might be done as PNG, not because you wanted them to be "lossless" but because JPEG would mess them up due to a lack of tools for reproducing non-natural photo content.
basically: JPEG XL does things right, WebP lossless is also not bad (14.8 % worse than JPEG XL), PNG is ok for its age (46.3 % worse), AVIF didn't focus on lossless (63.0 % worse)
It was kind of an artificial split, much like text, alpha transparency or line drawing might be done as PNG, not because you wanted them to be "lossless" but because JPEG would mess them up due to a lack of tools for reproducing non-natural photo content.
See the lossless comparison here for more:
https://jakearchibald.com/2020/avif-has-landed/