How can I check if there is a new build the same jenkins pipeline
This should be fairly straightforward to do in a script block.  I don't think there's a declarative-native way to do this.
I use this script block to cancel builds for earlier (i.e. outdated) revisions of PRs:
script {
  // currentBuild is a Pipeline-builtin variable for accessing the Build object
  // https://www.jenkins.io/doc/book/pipeline/getting-started/#global-variable-reference
  def build = currentBuild

  while(true) {
    build = build.getPreviousBuild()

    // exit the loop if we have finished iterating over builds
    // (groovy doesn't have a do...while feature)
    if (build == null) break

    def rawBuild = build.rawBuild

    if (rawBuild.isBuilding()) {
      // abort the build
      rawBuild.doTerm()
    }
  }
}

As you can hopefully see, this iterates over all previous builds and uses the isBuilding() method to find ones that are currently running.
If you want to check later builds instead of previous ones, you can use getNextBuild() instead (I believe the API doc is here, it's been a while since I wrote this so this might be the wrong class).
And if you want to check only one directly adjacent build instead of all earlier/later builds, you can just omit the loop and only call getPreviousBuild()/getNextBuild() once.