That is because of the inboard Aileron. Many aircraft have two sets of ailerons. Having the ailerons as far out on the span work best for controlling roll rate. However at higher speeds they produce twisting loads on the wing which can nullify the ailerons and even reverse the aileron direction (turning the column left could make the plane bank right). There's also a risk that it could overstress the wing. So they put an inboard aileron in at about a third the plane's total span. Usually short in total span, and placed on a thicker area of the wing that isn't going to bend. At low speeds both inboard and outboard ailerons work together. Once the flaps go up as a rule the outboard ailerons are centrally locked in the neutral position and only the inboard ailerons work. At higher speeds the inboard ailerons can produce the same roll rate as the outboard aileron could at low speeds. The inboard ailerons usually have a larger range of travel as well. Where the inboard aileron is, is where the gap in the flaps are.
There are exceptions to this rule. The DC-8 has the inboard and outboard ailerons paired together, so does the A-330 and -340, and just one huge flap. There is a thrust gate though to allow the thrust to go through right behind the engine (DC-8 only).
Some aircraft feature just outboard ailerons. Such as the DC-9, 757, A-319/-320/-321, and 737. They don't have very large wingspans and their wings naturally don't flex as much at the tips. Additionally the wings are deliberately strengthened so that the ailerons do not impose twisting loads on the wings.
If you look at the 757 also, it does not have a gap. It has double slotted flaps inboard and outboard, and flap-gap is filled with a single slotted flap. They are attached and extend as one.
Additionally, some aircraft don't have outboard ailerons. The Convair 880 and 990 are examples. They feature a large inboard aileron, and I think they use spoilers to augment roll-rate at low speeds. Maybe I'm getting confused with the B-52 though. The B-52 BTW has only an inboard aileron with spoilers to assist roll-rate.