In brick/masory homes the vertical slots are called weep holes.
Their purpose is to allow the rain water that soaks through the brick to come back out. From what I learned, about 10% of what gets on the brick passes through since the brick is porous. On the back side of the brick there is a drainage plane, or surface that has been traditionally tar paper nailed or stapled over the wood framing. The paper is lapped so the water as it collects goes over the laps and continues down where the through wall flashing turns it back out the wall through the weep holes.
I just re-read the question and seen I really did not answer the question at all. The horizontal gap is typically not there. as Lee Sam mentioned, counter flashing should be there, but I hope is still there deeper inside the recess.
For some reason the builder decided to set the brick on a steel lintel (beam of a sort) above the roof, instead of below the roof where this space would not be seen. If the through wall flashing allowed it, typical counterflashing could still be applied although there would be no backer for it. Backer would keep it in a vertical plane. As a mention counterflashing is used to cover the base flashing that is covering the tops of the last row of shingles.
This sketch is not the only way to do it, but it is the best way to do it, IMO. The problem is, the potential to damage the all important through wall flashing is quite possible (the black line behind and under the brick).
To simply fasten something on top of the shingles for the sake of holding something in place to hide the gap would also have a strong possibility of making leaks in your roof.