Extract pdf page range in pdf for every change in the heading

Hi team,
Need help with pdf page extraction.
There is a PDF file consisting of 500 pages or more.
pages will have a text as a heading example block 1 , block 2 and block 3…etc
I have block 1 in 1-23 pages and block 2 in 24-50 and so on… I want to extract the pages seperately when ever there is a change in block… Like 1-23 as one file with file name Block 1 and 24-50 as block 2 and so on… I have block’s information in one excel file for a search.
Your help would be appreciated.