I’m partial to the Keltec Sub 2000. Folds to 16”. Comes in 9mm or .40.
Can get them in several varieties of pistol mags, Glock, Beretta, S&W.....
https://www.keltecweapons.com/rifles/sub-2000
I just wish you could put optics on it and still fold up.