AVIF consumes around 25 times more CPU during encoding as JPEG. Take this in consideration if you pay for the power consumption. And on the user-facing side, if you upload an images it takes f.ex. 12 seconds (sic!) and not half a second.
This is also the reason JPEG2000 died off and became a niche format mainly for archival; it's extremely CPU-intensive.
You can adjust the speed of both, you don't have to use the default of whatever library versions you're using. My cjxl defaults to 2x more CPU than avifenc's default, but I can make it 30x more or 480x less; libaom certainly lets you waste a lot more CPU than libjxl, if that's what you want.
I don't know if anyone has published an encode time / quality comparison of the various encoders. It'd have to be recent to include this year's libaom image optimizations.
12 seconds? It takes 7 seconds on my phone, in a wasm runtime using an older version of the encoder.
From my experience throwing random JPEGs at it, it's 3 to 4 times smaller, that's a good chunk of data saved, which in turn is a lot of energy saved on visitors' radios being active.
Unlike with jpeg, you don't need 85 or 95 percent on the quality score, 50 is more than good enough for most pictures on a website.
If you're hosting images and want a fully lossless encoding the CPU time may become a factor, but if you're hosting user generated content, I don't think it's all that bad. Plus, you can just move the encoding part to the user side of the equation and pretend it's part of the upload progress bar if you're desperate to pay the power bill.