I always use the local currency, but there are countries around the world where you might use US dollars or Euros.
In St Petersburg, some of the people selling gifts and other trinkets don't expect the cruise boat crowd to get Rubles, so they accept US dollars or Euros quite readily.
In Dubrovnik, you can spend euros in many places.
When I arrived in Sarajevo by bus from Belgrade this year, I didn't have have local Bosnian currency yet. The taxi driver didn't even quote a price in Bosnian convertable marks, he asked for euros, which I had.
In Africa, many countries are eager for US dollars or euros, but this is because their own currencies are so weak and devalue by the second. I tried to use local currency during my trip to Africa, but I took US dollars as a back-up because the ATM machines in many places in Africa are unreliable.
But when you spend dollars or euros in these countries your exchange rate will be poor, you will almost always spend more than if you were to use the local currency.
Parenthetically, while in Africa last year, many vendors didn't want our money, but our clothes and shoes, because if we give them money to pay for things they still can't buy good clothes or shoes because these are not available in Africa. I left my hiking boots and cargo pants when I left on my last day. Other people in the group left socks and shirts.