Citing page numbers of unpublished work The journal I'm writing a paper for has an author-year-like citation style which includes page numbers. For instance: "... by Doe (2018, 58) ..."

I now want to cite unpublished work. The bibliography entry has "To appear in Journal X". The exact issue number and page numbers are unknown. As far as I can see, this means that I can only use imprecise references (only year, no page number) to this article. Or is there another way? The paper I want to cite will appear in a journal that does not number sections.
If there is a preprint version online, and you are certain that what you want is going to appear in the published version, cite the accepted version (to appear etc), but also include a mention of the preprint, where to get it, and where the specific thing you want appears in the preprint. If you know something because the author has shared with you a version of the accepted manuscript it might be worth noting their input, something like "the authors have kindly shared the accepted version of this paper, the relevant material can be found in the preprint version at [address] on page [blah]". It's not as snappy as author-year-page, but it will do what references are supposed to do: point a reader where to find information. Practices like removing titles from bibliographies, compressing not over-long author lists to "Aarons et al" and so on are hold-overs from days when publishing was only on paper, and typesetting was by mechanical means, and expensive. Pixels are cheap. If you have to "break" a rule of citation style to make the citation clear, then that is no crime.

If the publisher allows it, please consider asking the authors politely if they can post a version of the article in some repository at its closest-to-published state (is this in an arXiv-using subject? I can't tell if this is the case from your question). Most publishers have some threshold where they are happy for this to be done, even if only under an embargo. Remember: the literature is for posterity, so if next year someone wants to check their paper after reading yours, it can be available, even if it is not publicly accessible on the open web right now.

Also, there's not much wrong with citing page "n of m" where m is the total number of pages of their article, because people can count, and will infer where in the officially-numbered version you mean.