Don't do it often, but if I need to pull a particular loop from a video or something, ffmpeg works perfectly fine.
You can use LosslessCut or Avidemux or something to trim the video to the few seconds you want to loop and then do the rest with ffmpeg. Technically, you can do it all with ffmpeg, but LosslessCut is just a nice GUI for that exact purpose (pretty sure it uses ffmpeg as a backend).
Actually, LosslessCut may be able to export to GIF, but I think I tried once and had issues with that. Could be misremembering.
Need to add in some flags and filters with ffmpeg, though, otherwise it just straight converts it to the absolute highest quality in the highest resolution and at the same source framerate, which leaves you with a massive file.
I'm not certain about editing actual GIF files. ImageMagick might help there, and I know you can throw a GIF into GIMP and make changes there, but it's really cumbersome.
For creating new GIFs entirely out of unique static images? No idea, unfortunately. Never done that, I don't think.
I use normally just use EZGIF (an old-fashioned web tool), but I happen to also have Adobe Fireworks CS4 (which is from 2008) on an old MacBook for more advanced editing.
There's probably a good FOSS tool out there, but I don't edit or even create GIFs often enough to bother looking.