Don't let the keyboard layout fool you into false premises!
Use the guitar and it should become clear that what you start from in your question is dubious. On guitar there are no 'black' or 'white' notes (keys on piano). And you are probably aware that when you play , say, C E G somewhere, by moving everything up one fret, you get C♯ E♯ G♯. Up to wherever, use the same shape, and you always have a major triad - on whichever strings you choose. And - that F isn't in the triad - it gets called E♯. Honest!
To simplify even more - take your 0-4-7 formula, and use only one string. Let's say open G. 0=G, 4=B, 7=D. now add whatever number you wish to those start numbers, and play. You make that triad again every time, so whatever the note names, 0=root, 4=third (M3) and 7= fifth (P5).
Using the white keys on piano to ascertain intervals isn't always the best approach, as you may now be aware! However, if you insist, then simply count the number of smallest steps (semitones, or each guitar fret) for half the answer. The other half will be revealed once you've established what the lower and upper notes are called. And simply playing them cold, and listening to them aint gonna work! They need to be written down, in a specific key, on a stave. Otherwise they could have any of two or more different names, depending on situation and their own names.
Just realised I haven't answered the question!
Yes, the black keys work in their own right, just as the white keys do, although they usually have ♯ or ♭ in their names. And when you consider that F is enhamonic with E♯, why shouldn't they? Any black key can be part of any interval, including 3rds and 5ths (and everything else) Yes!