Can a urinary tract infection cause you any pain while having sex?

Yes. Inflammation of bladder and urethra from a UTI makes the area tender and thus may well cause pain with sex. For either sex.
Yes. Frequently urinary tract infections can occur after sex due to the mechanical effects of intercourse on the urethra (tube that connects to the urinary bladder). If infection is already present then the urethra or bladder may be inflamed and therefore any further irritation or movement could cause discomfort.