Whenever my dog mates, he ends up stuck inside the female.
Attempts to separate them prove futile.
Why are they stuck together after mating?
The males penis will swell inside the females vagina during the mating. This will cause them to get stuck. It is completely normal for dogs to get stuck together after mating and you should not attempt to divide them. If you don't want them to mate you should have had enough time to try separating them before.
Our non-neutered female dog mated with our castrated male a few times. Especially during the first few times we had to secure them, as she got very excited after the mating. She tried to run away and this caused or male incredible pain. I held her by her chest/neck area so she could not run away any longer and waited until they separated on their own.
The time it takes for the swelling to reduce and allow separation differs, one article on the breeding tie suggests a time between 2 and 30 minutes. I quote some other information from the article I think is noteworthy:
Note that the article is about breeding, thus I removed information that does not relate to your question about mating.