I would argue that if you do not know what size bike you need, then you want the help of a bike store plus a test ride at minimum. Alternatively, you could consider an online-only brand like Canyon that guides you through measuring yourself, but they generally have return policies that allow you some leeway. I think most observers would agree with this.
The recommended heights for each frame size are only a rough guide. A lot also depends on your torso and leg length. All else equal, I believe that people with proportionately longer legs tend to be a bit trickier to fit.
Focusing narrowly on the issue of sizing down or up, I would generally size down if I were at the boundary between sizes (as determined by my desired frame stack, reach, and seat tube angle parameters, not by my height). Within limits, you can raise your saddle, raise your stem, and get a longer stem to compensate for a slightly small frame. You are probably more limited in lowering your saddle or stem for a slightly large frame, and a shorter stem will generally make the bike handle slightly faster.
Personally, I know that I have a long torso. I know that my current custom bike has a stack around 550mm and a reach around 400mm, with a 100mm stem. See this answer for definitions of those terms. Sticking to drop bar bikes, I recently bought a gravel bike with a 554mm stack and a 365mm reach. I knew that I wanted a slightly shorter reach to my handlebars the same and the same or slightly higher stack. I could estimate that a 120mm stem would get me close enough to that goal. I did ask the store to fit that length of stem and let me take a test ride. If there was a bike that I was sure I wanted, I would be able to buy one based on the published geometry information alone. The bottom line is: it's possible to buy a bike based only on published geometry, but this requires some knowledge and experience.