Trigger previous pipeline job

We have pipelines with a cleanup stage and job that is manual to be run.
We want the next build number of that pipeline to when it gets to a successful stage it triggers that cleanup job on the previous build.

How can you trigger the previous build id’s job? All examples of remote trigger jobs are to run a pipeline/job but that would be a “new” build id and not using the values from the buildID we want to cleanup.