Lossless formats such as PNG keep every pixel exactly, which suits screenshots, text, logos and anything with sharp edges or transparency. Lossy formats such as JPEG throw away detail the eye is less likely to notice, which makes photos far smaller.
WebP and AVIF can do either. Saving a lossy file repeatedly loses a little more quality each time, so keep an original and export copies from it.