The Quick Selection and Magic wand Tools have options the effect the selections edges. So if you problem is in edge areas you may want to play with these options. When there is smoothing feathering etc in edges reversing the selection I think may show some fringing in edge areas. You mat need to tweak the mask.
The picture below contains 2 selections. One is created with the Quick selection tool and for the second a straight selection with te Retangular tool. The second picture is using exactly the same selections but vice versa and at the third picture shows only these two layers are visible. I added a third red background layer so that you can see the red lines where the pixels disappeared.
Settings for Size, Hardness and Spacing are resp. 2, 0, 0
If i change these values, the selection tool react different but i still miss some pixels.
That more or less confirms what I wrote is correct "When there is smoothing feathering etc in edges reversing the selection I think may show some fringing in edge areas. You may need to tweak the mask."
There may be rounding involved in the edge area so the values are not perfect with rounding. Edges may need to be absolutely hard no smoothing anti-aliasing etc
With the rectangle tool are you creating path and vector layer mask aligned to the pixel grid
Well, as you can see. These are my settings for creating the layer with mask for the selection. Excuses for the Dutch screenshot but i know you can manage it.
I tried to get the lines (borders) as hard as possible to avoid the missing pixels, still, I miss some
If you have better suggestions for these settings, please let me know
I do not know what you are even using there. It look like some refine edge thing I do not think if the is smoothing anti-aliasing or anything like that involved if setting will help. The masks will not be perfect with each other you will see edges.
A couple of things you can try: If your dealing with selections, use Select > Modify >Expand (or Contract) one one or both of the selections. For masks, make the mask the active channel, and Filter > Other > Maximum (or Minimum), again on one or both. Either way you'll only need a value of one (maybe two) pixels.
The exact combination you need to use depends mostly on the relative brightness of the image itself, and may require a bit of experimentation to get the most pleasing results.
This is very similar to "Trapping" in four-color offset printing.
[P. S. - I'm sure I'll get flack for advocating a destructive-editing, old-school method, but it works for me ]