529 funds that are distributed in 2019 can be used for any qualified expenses that are paid in 2019. If rent for June and July isn't a qualified expense, 529 funds cannot be used to pay the rent for those months, no matter when the 529 distribution is taken. I don't know what you mean by "used during the semester." If the student was enrolled full-time as a senior from September 2018 to May 2019 and the November and December 2018 (part of the fall semester) rent was actually paid in January 2019 (part of the spring semester), a 529 distribution taken anytime in 2019 to pay for the November and December 2018 rent would be proper.
Edited to add:
Re-reading the original question, I realize that I may have misinterpreted it, and therefore provided an answer that is totally not useful. Any rent paid for a period when the student is not enrolled at least half-time is not a qualified 529 expense.