You know about shift-click? They let you select specific items, without using a drag-select.
Hold shift and click the two rectangles. They’ll be the only things you have selected. For confirmation, at the bottom of your screen it should say “2 objects of type rectangle selected”.
Keep an eye on that text at the bottom of your screen when things don’t work like you think. The status messages there can be important to figuring out the issue. For example, if you tried to union two groups, it will throw an error, because the groups aren’t paths. That sort of thing.