GIF is the internet's court jester: 1987 technology that still runs every group chat. It was born in 1987, CompuServe, and its real weak spot is color depth and size: 256 colors per frame and no modern compression.
WEBM is video the way browsers like it: open, royalty-free and built to stream. A Matroska-based container restricted to VP8/VP9/AV1 video with Vorbis or Opus audio. That makes it the right destination when what you need is embedding on the web without licensing worries.