I have a problem trying to limit motor speed to a certain RPM using a MOSFET trigger switch module
Your problem is that you don't know what ADC value maps to the maximum RPM. If you did you wouldn't need to know the RPM.
What you have here is a &quot;feedback loop&quot;, and what you need is some method of using the detected RPM to control the speed of the motor.
You need to decouple the potentiometer from the analogWrite completely - the potentiometer should be setting the desired RPM, not the value being sent to set the RPM.
So if you want an RPM range from, say, 0 to 100RPM you can map() the analogRead() to the values 0-100. Then you can examine the actual RPM and adjust the value you send to the PWM accordingly - if the motor is too fast then slow it down. If it's too slow then speed it up.
There's a special method that is used for this: PID. And there's a library that does it for you too:

https://playground.arduino.cc/Code/PIDLibrary/

The potentiometer provides the &quot;set point&quot;, the RPM detection provides the &quot;input&quot;, and the PID library gives you the &quot;output&quot; to feed to the analogWrite().  You need to then provide the special magic &quot;tuning&quot; parameters to give the best control over your motor.