There are a number of issues which are probably going to make this difficult for you:
Traditionally, partitioning software liked to align partitions to logical tracks, so if you have 63 sectors per track, this meant aligning partitions to multiples of 63 sectors. In practice this is a small amount of data much smaller than a megabyte.
However, hard drives have been using logical (ie, fake) addressing where the tracks and sectors are meaningless, for a long time. In reality hard drives now use a variable number of sectors per track from the outside to the inside of each disc.
Nowadays, with flash and SSD drives being popular, partitioning software tends to prefer aligning partitions to multiples of 1MB.
The first partition cannot be at the very start of the drive because that space is reserved, so the first partition can only be either 63 sectors in (if aligning the old way) or 1MB in (if aligning the new way).
If you first partition was created with older partitioning software, it probably starts at the 63rd sector. If your subsequent partitions were created with newer partitioning software, it probably starts on a multiple of 1MB. Because these don't align, there will be a space between them of <1MB.
There is absolutely nothing wrong with this, particularly on a traditional hard drive (eg non-SSD) or as in your case, a virtual one. You can align however you like with no performance penalty. In addition, a space penalty of less than 1MB on a 50GB drive is so miniscule as to be ignorable. Don't put yourself through the trouble just to save less than 1MB. Your only issue is that it looks kinda ugly in Gparted.
Your other partition (sda5) is within an extended partition. Gparted is currently unable to move the boundaries of an extended partition. In addition, due to the space required at the start of an extended partition I have a feeling it's impossible to align it to a 1MB boundary and not have a very small amount of wasted space around it.
The other partition is a swap partition. Gparted may not be able to resize swap partitions, but that's no problem, since it's expendable data anyway so you can just trash it and create a new swap partition a different size.
That said, I can solve your problems. sda5 is only swap, so instead of resizing it, trash it, then trash that extended partition around it. That will consolidate all the free space into one blob.
Then, create a new swap partition occupying all that unused space.
You may still have <1MB gaps between partitions for the reasons highlighted elsewhere, but Gparted usually don't even show these if they are just around normal partitions.