Have to agree with Sam that in the first instance a vet visit is required to rule out any medical issues, such as cystitis or similar.
After that, possibly change the litter type or add more trays as has already been suggested, some cats are very fussy about using the same tray for poos and wees.