If your website google ranking is affecting, website can affected because of many resons. Like when your website is new and you start to indexed your website and your website ranked, and after sometimes if is your website ranking suddenly going down. It can be you have created many spammy backlinks, means your website spam score has been increased and It also can be your website is not secured.
If you have old website and website getting ranking on google for a long time and suddenly you see your website organic traffic is going down. For behind this issue the reason will be google latest algorithm or google core updates.
And if you want fix that issue, you should learn google algorithm updates and you need to optimize your content according to google algorithm updates.
And if you have majored all the website content and your website is not indexing and or not getting ranking. You should check your website robots.txt file, because sometime user disallow the whole website they use "Disallow : /"
that instruction. Because of that instruction google don't indexed your website.