The answer to the question of whether google indexes #hash URLs or not is: Yes and No. Generally speaking, if you have pages URL design to load using #hash it is less likely that Google will index it. But same page anchor link can be indexed by Google.
The anchor link will NOT load a new page but it will take you to a specific part of the page. Now, in this scenario, as the page is big, it will take time for users to find specific content because of that Google sees the value of crawling the anchor link to serve best to the user.
Case 2: New Page Load with Anchor Link URL
You may have come across websites where a brand new page gets loaded with anchor links.
example.com (main domain)
Now, this one is difficult to get it indexed by Google. In a rare situation, you may get lucky but overall it’s bad for SEO.
You may know in past wix.com used to produce pages with #hash URLs. They looked ugly and very bad for SEO.
Whether you are using open source technology or you have designed your own website, it is not recommended to have #hash URL for new pages.
Hash URL good or Bad for SEO
If you are planning to create a page with thousands of words which can be very big to find specific information then it is highly recommended to create anchor links and place them on top as contents which will help users as well as Google to process the content and possibly index anchor text links.
Do not consider if you are planning to display a separate page. It’s not worth the effort.
How to Take Advantage of #URL Inside the Page?
We all know content is king and well researched good length content ranks better than thin content.
But the problem with pages with more than 4 to 5 thousands words becomes very difficult to read, navigate and bookmark to go to a specific part of the page.
And the solution to that is creating a list of short headings on top and anchor link (#section) them.
Over time you will notice Google will start to fetch anchor link in SERP which is a great help for user else you may have a higher bounce rate.