They aren't detaining people "willy nilly". They are detaining those who are either inadmissible or deportable through violations/misconduct or misrepresentation of their visa/visa waiver.
If you are either a law abiding tourist or law abiding LPR, you will have no issues.
If you dig deeper than the key information omitting supreme that is The Guardian, you'll find that Mooney had her original TN visa rescinded by the US in Nov 24 (The Biden Administration), she tried to apply at the CAN/US border and was rejected and then travelled to the MEX/US border in an attempt to try apply and get through again and was once again rejected and detained there. Furthermore, she was trying to move hemp products into the US without the correct certification in her possession.
To summarise a few others:
. UK citizen: Unauthorised work on her tourist visa (illegal), misrepresentation of her intentions on her tourist visa. This only came to US attention after Canada acted as the whistle-blower and denied her entry because they were worried she would work.
. German tourist: Detained at MEX/US border with full tattoo equipment on suspicion of working unauthorised and illegally on her Esta. Proof from Instagram and SM dms showed intent to work and be paid for it.
. German LPR: Detained on re-entry into the US. Had a current drugs charge that he'd skipped his court day for by leaving the country
. LPR deported to Laos: Incarcerated for 2 years on drugs charges and after that remained involved in criminal gang activity with human trafficking, firearms trafficking and drugs trafficking to include Cannibis, Meth and Heroin
. Doctor LPR: Detained on returning to the country. Was previously on a J visa and had gone through the H1B visa process. Her H1B was flagged for potentially residency issues (time spent in the US compared to outside the US) and was flagged further after attending the funeral of terrorist Hezbollah leader Nasrullah and concealing evidence by prior deleting photos (left in deleted items folder)
. French academic: The media are focusing on the phone searching (only happens if you have red flags and pulled into secondary) whilst omitting and glossing over the fact he had security classified information on his possession, no official paperwork or documentation that provides a waiver for carriage (anything classified S or above have special carriage instructions that usually involve the need for 2 people being present) and attempted to conceal/hide it.
. Numerous other smaller detentions not making mainstream media involve LPRs violating the residency requirements of a green card and essentially attempting to cheat the system with living abroad but "visiting" the US to try keep it ticking over.
Again any law-abiding tourist following thr requirements set out for an Esta or B1/B2 or law-abiding LPR will have no issues travelling.
The media have an agenda and unfortunately revel in causing fear and panic.