What if I am with someone else and that person commits a crime, can I get in trouble?

Yes. You could actually be charged with a serious felony even if you weren't the person who committed the crime. You could be accused of aiding and abetting and could be charged as an accomplice.