Can you have someone see if the brake lights are blinking when the clicking occurs? If so, the brake light switch is going out and needs to be replaced, if not I would replace the shift lock solenoid. Here are the locations of both so you can check it out. Let us know what happens and please upload pictures or videos of the problem so we can see what's going on.
Images (Click to enlarge)
Tuesday, March 21st, 2023 AT 9:54 AM