The safest way might be to try to gently pull the dogs away from each other. If not then maybe a bit harder. If they do not have their leashes on then try to distract them with something else. Maybe pull on their collar too.