I've experienced this and there was a number of changes I made to resolve it...although it's not happened since, im half expecting it to appear again. I still don't quite understand the underlaying issue but here's what I did in reverse order:
Move nuget.config from your web project into your solution folder.
In the build pipeline - Add the step nugettoolinstaller before you call restore and mark 'checklatest' : true.
In the build pipeline - In the restore step; set "feedsToUse" : config, nugetCOnfigPath: ./nuget.config and noCache : true
I'm having intermittent problems with package restore in a DotNetCoreCLI publish step in an Azure Devops pipeline. The step sometimes fail with: