Yes, in some cases, but this is not automatic, nor even close. The more serious the trial (ex, murder, child pornography), the more likely it serves the court’s interest to use the illegally obtained evidence. See https://doi.org/10.60082/2817-5069.3711 for a longitudinal study. Illegally obtained evidence is routinely used.