How are range and frequency related in HF communications?
Neither or both, depending.
Unlike VHF and higher bands, which travel mostly via line of sight and therefore have limited range depending on altitude, HF radio relies on skywave propagation. This means the radio waves travel up, bounce off a layer in the upper atmosphere and then travel back down to the receiver. They may even bounce up and down between layers several times, allowing one to receive signals from the other side of the planet. You may be able to talk to stations far away but not nearby, or the bounces may not work the same in both directions. It’s unpredictable.
All of this odd bouncing depends on atmospheric conditions, which vary from place to place and even from hour to hour. Worse, different parts of the HF band will behave differently at the same time and place, so it has been broken up into several sub-bands of frequencies that tend to behave similarly.
That is why oceanic flights are given two HF frequencies in different sub-bands: at least one of them will probably work. Probably. And which one (if any) may change over the course of a long flight!
Worst of all, because of this long-range behavior, every station on the planet needs a unique frequency, and there isn’t a lot of bandwidth to go around, which is why it is chopped up into very narrow channels that give horrible sound quality. So, HF is only used when absolutely nothing else will work (or is available).