It's definitely worth a go, but best to only do an all out 5k every so often. I went through stages of trying to beat 20 and then 19 minutes once a week and it was horrid and made me hate running
I haven't been that way for ages, but Watermead is a really good parkrun course for a decent time. I think they have pacers for 18 minutes upwards once a month (or at least they used to).
As others have said - they're so different as to what each takes but I'd probably agree that the 5k effort is more difficult.
Any kind of flat out 5k effort, regardless of your ability, is just awful. You're struggling from moment one until you finish with a super high heart rate all the way through. Whereas a sub 4 marathon, or even anything quicker, you have moments where you just settle in to the rhythm - you can make up time at various points if you have a tough mile or two.
So long as you put the 12/16 week block in for the marathon, and fuel properly on the day, then more often than not you'd get a half decent time. Not that it's remotely easy, I guess it comes down to whether you prefer to struggle to breathe or struggle to walk towards the end of a race
I'd hasten to guess that I know more people who have done sub-4 marathon than a sub-20 5k (of those who have done both). Particularly the women, for whatever reason.