First, can you please elaborate: do you mean that you received an existing PDF, then created a new PDF from an InDesign file, and observed visual differences between these two unrelated PDF files? If so, then it's unclear why you would expect those two files to be identical in the first place.
Second, do you have any particular reasons to use InDesign 2022 instead of the current version, InDesign 2025?