Position in the file, not the number on the paper
The page index is the position in the document page tree, starting at one for the first page in the file. The printed number is ink on the page, placed there by whoever produced it, and the two agree only when the document starts numbering at its very first sheet.
Front matter is where they diverge. A report with a cover and a contents page typically prints "1" on the third sheet, so everything printed is offset by two. A scanned bundle with a separator sheet has a similar offset. Deleting "pages 5 to 8" as printed in such a document removes pages 7 to 10 as far as the file is concerned.
The reliable habit is to read positions from a page thumbnail panel or from the viewer page counter rather than from the page itself, and to check the resulting page count immediately after the operation.