Just to add a bit on this. The (U.S) Bill of Rights applies to any person on U.S. soil. (That is a common misconception apparently but like many modern constitutions it refers to persons and not citizens). There is the gray area surrounding around the periphery of the U.S. and borders (https://www.aclu.org/other/constitution-100-mile-border-zone)
(Essentially the U.S. government reasons that the area surrounding the border is U.S. soil for CBP, and not U.S. soil for anyone else.)