You have to choose which to prioritize, pos or rot. You can’t always have both. Consider this two-bone IK below:
Three basically identical armatures. If we prioritize pos, we can reach the IK target with the tail of the bone most of the time. But if we prioritize rot, we can’t. The third image demonstrates why: if we constrain both the loc and rot of the final IK bone, there’s no solution for the first IK bone. There’s no orientation it can be in, because the head of its child is too close. (Or, too far.)
What’s generally done to kind of split the difference is to use a combination system, where we use IK on all but the final bone, but give the final bone a copy rotation constraint (or something equivalent):
Now we can completely define both the rotation of the final bone, and the point reached by the second-to-last bone’s tail. The two of those things end up completely defining the final bone, which completely echoes our IK target, unless it moves out of reach.