There are other extension tasks you can use to replace variables in your config files, besides Replace Tokens task mentioned by Krzysztof. For example RegEx Find & Replace Task and Magic Chunks task.
When you use Replace Tokens task or RegEx Find & Replace Task. You need first define a variable in your pipleline to contain your build id value(eg. BuildId).

If you need to set the buildid dynamic in your pipeline, you can check here to dynamic set the variable in scripts.
Then modify your deployit-manifest.xml to tokenize the buildid (wrapped with Token prefix #{
and suffix }#
).
<ctep.Application name="/MyApp" file="/MyApp/MyApp-#{BuildId}#.ear">
Then config the tasks as below (examples are in Yaml view). And keep other settings as default.
Replace Tokens task
- task: qetza.replacetokens.replacetokens-task.replacetokens@3
displayName: 'Replace tokens in **/deployit-manifest.xml'
inputs:
targetFiles: '**/deployit-manifest.xml'
RegEx Find & Replace
- task: knom.regexreplace-task.regex-replace.RegexReplace@3
displayName: 'RegEx Find & Replace'
inputs:
InputSearchPattern: |
**\deployit-manifest.xml
FindRegex: '(#{.*}#)'
ReplaceRegex: '$(BuildId)'
You can use either one of above tasks to do the work.