As you can apply actions and other functions to the filtered and selected files and these functions only affect the currently visible selection and not the hidden ones, I would say, that any kind of selection can only work with visisble files.
It would be fatal if you cannot be sure that actions etc. only work on visible files. You would have to remove the selection every time you intend to filter just to avoid any treatment of the hidden ones.