The clicking sound is a problem with the taptic engine failing. Your best bet is replacing the taptic engine - iPhone X Vervanging van de trilmotor
The taptic egnine itself is a very cheap part, around $10 USD and most phone repair shops would probably charge less than $100 to fix this. As many mentioned before, you will lose the IP65 (waterproofing) rating.
You would hope apple would replace this part under an extended warranty program, but they don’t really care about their phone users much. It’s most likely planned obsolescence. fixit, and your iphone X is good for another 5 years at least.
Can’t believe people are suggesting to turn off vibration. What happened to this community. This is ifixit, not iworkaroundit or idontcare. However, turning off “System Haptics” is an option, if you don’t find loosing all haptic feedback.