The court said law-abiding residents who have deep community ties have stronger constitutional protections than those who are detained at the border.