Hi, dear!
I think it depends on your use and cost control.
Regardless of peripheral factors such as cost, the higher the resolution of the codec, the better.
Of course, for the sake of your solution, you should choose the matching product. This saves costs and makes the solution work better.
For more, the following is a comparison between H.264 and H.265.
H.265 Vs H.264