Based on your requirement, you could refer to the following process to automatically trigger the release on Azure Devops server and replace the tag with the variable.
my build pipeline is in azureDevopsservices and my release pipeline in azuredevopsServer
To automatically trigger the release in Azure Devops Server, you can refer to my reply in your other ticket.
Replace docker tag in release pipeline
As far as I know, the Replace token task can meet your requirement.
From your docker tag format, it seems that this is the $(build.buildnumber)
variable in Azure Devops Service Build Pipeline.
- You could set the variable in Release Pipeline and set
Settable at release time
option.

In deployment manifest, you could set the image with the following format: image:mycontainerregistry/myapp:#{Version}#
Use the Replace token task and select the target file.

- When you use Rest API to trigger the release , you could pass the varible to release pipeline at the same time.
Here is the sample:
$token = "PAT"
$url = "https://{instance}/{collection}/{project}/_apis/release/releases?api-version=5.0"
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))
$JSON = @'
{
"definitionId": ID,
"variables": {
"Version": {
"value": "$(Build.buildnumber)"
}
}
}
'@
$response = Invoke-RestMethod -Uri $url -Headers @{Authorization = "Basic $token"} -Method Post -ContentType application/json -body $JSON