IMHO learning songs to play off the cuff is not a simple thing to do, it requires repetition, focus, and memory method.
25 years ago I spent nearly 2 years doing a Music BTEC. Every 2 weeks we had to pick 3 new songs/pieces to play and be able to solo on one, the was in a small band scenario. Each band had to perform them live to a public audience. So how did we learn(memorise) the songs, the answer is very few did, most had the basic structure in their heads and nearly all were improving the solo or playing something close to the original, and when we performed we had simple chord/lyric sheets to refer to as prompts,
To learn a simple song structure fully and retain it forever is not a simple thing, especially as you get older. Take ‘Wish You Were Here’ Pink Floyd as an example, it is actually quite a complex piece to learn fully, especially in entirety with solos. I started the process with Justin’s lessons on it in September 24, I had the intro and 1st solo playable after about 2 months of struggle, and the verse/chorus came along in a simple form. Then I wanted to play the rest so set to work on the using an app to play along with. It wasn’t until around March 25 that I felt comfortable playing it without many mistakes, some of the length of time wa due to my playing skills were low initially. I must have played WYWH least once/twice a day for over 3 months. Now to the reality do I know enough to play it from memory with no prompts, NO is the answer. Recently I started BLIM and I not played WYWH for 4 weeks, along with other songs. So I tried to play it, 1st attempt the intro was messy and wrong, it took at 3 more passes making corrections before it was back, the verse/chorus was similar, and I still have to get the solos back in shape.
The point is professional musicians will be playing the same songs hundreds of times, and very regularly, eventually each song becomes second nature to them, as they add new songs they learn them perform them and so the process continues. But even they will rehearse before a tour to refresh old and perfect new material.
I doubt many off us here are even semi-professional musicians, and most that do perform do so at open mics or similar doing 2 or 3 songs, so it an easier task but will take longer to learn new material.
It’s the way it is, I would try not to beat yourself up over it, keep practicing a set small repertoire as Justin advises regularly, and they should become like a pair of comfy slippers you slip into. Also it should become easier and quicker as guitar skills improve, I have noticed I can learn how to play a song much quicker now than last year, but it also depends pick tricky technical one or requiring a new skill and it can take much longer.
Anyway enough rambling from me, that’s my perspective on learning songs,