JPEG is a compressed format; it intentionally sacrifices quality for smaller size. It still has its uses, but it should never be used where image quality is the primary concern. There are many widely-adopted alternatives that suit other purposes and have no data loss. One alternative, PNG, is supported everywhere that matters, but there are plenty of others.
We need lossy state of the art codecs, PNG sucks for large images. TIFF and EXR are also great. But I think we need a lossy large image format, probably based on AV1 and similar technology.
JPEG is still used because of ubiquity and because it always was good enough, we have over two decades of better replacements lined up if we need them.