"如果有需要的话" can be translated into English as "if necessary" or "if needed". Both expressions are commonly used and convey the idea of doing something when the situation calls for it.
For example:
"If necessary, I will stay up late to finish this project." (如果有需要的话,我会熬夜完成这个项目。)
"Please contact us if needed." (如果有需要的话,请联系我们。)