Other 2 answers describe current situation, but the origin is much older. In 1699 Repubublic of Ragusa (now Dubrovnik) ceded Neum to the Ottoman Empire, to prevent land attack from Venice, as Dalmatia was part of Venice that time. Than BiH and Croatia just inherited the borders.
While not having any idea of their history, seeing how they ended up it seems rude to even ask.
Other 2 answers describe current situation, but the origin is much older. In 1699 Repubublic of Ragusa (now Dubrovnik) ceded Neum to the Ottoman Empire, to prevent land attack from Venice, as Dalmatia was part of Venice that time. Than BiH and Croatia just inherited the borders.
https://en.m.wikipedia.org/wiki/Neum#History