Can they be used interchangeably? If not, in which situations should I use the former and the latter?
When they're interchangeable...
The following sentences are typical uses of "but/however" (note the different punctuation, hat tip:@snailboat):
I wanted to go to the store, but I didn't have enough time.
I wanted to go to the store; however, I didn't have enough time.
In these sentences, the two words are essentially interchangeable. The version with "but" is probably a little more informal.
When they're not...
There are other uses of the two words, however, where they are not interchangeable. Here are a few examples:
Examples where you can use only "but"...
- I liked all but one of the songs on that album. [used as a preposition to mean "except"]
- I am but your humble servant. [used as an adverb to mean "only"]
- I don't want to hear any ifs, ands, or buts. [used as a noun as part of an idiom]
Examples where you can use only "however"...
- I'll pay for it however I can. [used as an adverb to mean "in whatever way"]
- There are other uses of the two words, however, where they are not interchangeable. [used as an aside]