Generally, a voluntary statement to police isn't automatically unlawful, but its use in a trial is a complicated matter. The key factor is whether it was obtained properly. Police must adhere to specific guidelines, https://panchanandshaw.com/blog/contempt-notice-explained/