Anything you say at any time can be used against you in a court of law. The only exception is that police are required to inform you when you have the right to have an attorney present. Police inform suspects about the right to remain silent so people are aware that they do not have to speak to police without first consulting an attorney.
Miranda rights come into play during a custodial interrogation, meaning questioning while the police are restricting your ability to get up and leave. So, if the police have not taken you into custody in any way, they are not required to read you your Miranda rights and anything you say to the police can be used against you in the court of law.
However, if you are in police custody and you do invoke the right to remain silent, the police must stop the interrogation. The police will not be able to resume the interrogation until you have consulted with an attorney.