In case of an early departure or late arrival, it may be worth looking for accommodation near the airport due to the greater distance from Dubrovnik.
Hotels near the airport
There are several private apartments within walking distance just off the main road (about 200-300 metres) with prices around 40 eur to 55 eur per night. The owners are usually prepared for late arrivals and can be arranged for a late check-in.
Examples of apartments within 300 meters along the sidewalk:
You won't find a classic hotel near the airport.
Hotels in Dubrovnik
The city centre offers a much wider range of accommodation options, from more expensive luxury hotels to budget apartments and hostels.
Platanus buses cover most departures and arrivals, so even early in the morning you can catch your flight from the city centre.
If it's not about hotels at DBV, there is a pretty good place to sleep on the highest floor of DBV airport (eastern part of the terminal). For late arrivals or early departures this option seems quite practical.
Unfortunately DBV airport is not open overnight (at least in winter, I flew in December), they close from midnight to 5am.
If you're travelling within Europe, the earliest they'll let you into the airside is 2 hours before your scheduled departure.
At DBV airport they also close landside after the last flight, so maybe after 23:00 and open at 4:00.
Security can allow night waiting not only for the flight but also for the morning bus. The sofas are on the landside.
That's true - it can, but as I know from a friend, unfortunately it doesn't have to ☹️