're getting caught,
Security are not allowed to let their dogs off the lead if youre caught and they are certainly not allowed to let them bite you, if they did they would get in a whole world of trouble. Any loose dogs should be put on a lead the second security know someone is on site.
You do not have to give any details personal or otherwise to a security guard and any touching you or making you wait somewhere is also not allowed, technically assault and false imprisonment if you want to get heavy on them.
If caught somewhere make your apologies and calmly start walking away regardless of anything shouted at you.
Unless they tell you not to come back you can try again another day, if you're told not to go back somewhere but you do and it can be proved you then can be opening yourself up to aggravated trespass which is a chargeable offence but very rarely enforced.
I personally always take pictures of the holes I've gained entry through, no proof you didn't do it but a bit more convincing to show any police that may show up.
Technically the police can't do anything as it's a civil matter but they will remove you to avoid a breech of the peace which they can take you away for, if you're a prick with the police they have a multiple arsenal of petty charges they can use to hold you, search you and for the real special ones, take you to the station. Be polite and honest and usually you will be on your way home shortly after.
It's slightly a grey area whether you should give your details to the police, if you've done nothing wrong lawfully you shouldn't need to but they always try to worry you into doing so by saying it's the law etc, it's only the law if you've been arrested and you can only be arrested if they suspect you of committing a crime and they can only say that if they have sufficient evidence to suspect you of a crime however you'll stand there and do the whole am I being arrested? Do you suspect me of a crime? What evidence do you have of that crime speech and you'll find yourself getting into a loop with the police until they arrest you for suspected burglary in order to get your details, sufficient evidence being you've been dragged out of there.
Common sence is your most important tool in urbex, don't let it escape you if things go wrong, piss someone off and they will do anything to upset you and they are on the moral high ground so you'll always loose, manners cost nothing but are priceless in these situations.
Now, these are just my own mumblings and I'm sure there will be multiple people queueing up correcting me if I'm wrong (I'm not) so I advise anyone to do their own research and familiarise themselves with the law on urbex, these are just the rules and opinions I explore by.