They can only do it a) if you consent to them doing it (just because you're pregnant doesn't mean you have to do what anyone tells you to - they can advise, you can make your own informed decisions) and b) if your cervix is already beginning to ripen (efface and dilate; or get thinner and wider).
It's an intervention. Some women are happy to try to 'bring things on' others aren't. Read up online to find the pros and cons.
Some women find it uncomfortable, rather than painful. There's often a show, or small amount of bleeding, and in some cases labour starts within 24 hrs. Although, as your cervix has to have ripened to allow the procedure, it may or may not be related
If you're after personal experiences; I had a sweep with DS1, at 40+7, with my wonderful midwife, who explained what wa happening as she did it, and helped me relax through it. It was a bit uncomfortable at the time, had some mild cramping and bleeding afterwards. Went into labour within 24 hrs and had a happy, relaxed, intense, joyful, home birth.