Start with the delivery requirement
If the image needs to work almost everywhere, JPG and PNG are still the safe defaults. JPG is better for photos. PNG is better for graphics, UI elements, and files that need transparency.
If you are optimizing for modern web delivery, WebP is often the practical middle ground. AVIF can shrink files even more, but it can be slower to encode and may complicate older workflows.