With two separate tickets:
If you have checked luggage, there's no doubt about it, you need to go through passport control to reclaim your luggage and reclaim it. In which case you need whatever document is required for you to enter the country, even if it's only for a few minutes. In your case that means you need a visa.
If there's any other reason why you would need to go to a check-in desk (no mobile/online check-in, document verification...), the same applies. Sometimes you can use airside transit desks for this purpose, but this depends a lot on the airline, the airport, and the exact circumstances.
If you don't have any checked luggage, can check-in online or via mobile, and the airport allows it (I would suppose this would be the case in BUD, but I haven't checked, many airports do not allow it), technically once you arrive in BUD you could do an "airside transit" and not go through immigration, and in your case not need a visa. That's why border control tells you you don't need a visa and can stay airside: from their point of view, it's possible.
But as others have pointed out, the issue is you probably won't get to BUD in the first place: the first airline most likely considers that your final destination is BUD, and they will want to see documentation which allows you to enter Hungary before they let you board. There is a good reason for this: what happens if your first flight is late and you miss your next flight? What happens if the next flight is cancelled or they don't let you board? They don't want to deal with that (they have to if they sold you the connection, but not with separate tickets), so they just say no.
Some airlines/agents can be convinced to take into account your next flight, and thus apply the rules for transit through BUD rather than for entry into Hungary, even if the next flight is ticketed separately/on a different airline. But unless they commit to it in writing before your flight (and even then), you definitely can't count on it.
In comments you say the airline told you you don't need a visa. Double check with them that they have correctly understood that the next flight is with a different airline, ticketed separately. If they still confirm you don't need a visa, get them to tell you so in writing. But have a backup plan, arrive early at the airport, and be prepared to have a sudden change of mind of the airline (or, quite likely, the agents doing the work for them).
Also note that self-connections (with separate tickets) carry an inherent risk: if you don't show up in time for check-in or boarding for the second flight, you will be considered a no-show, your ticket will most likely be cancelled (possibly with further flights on the same ticket, like a return flight), and you will have to rebook and pay for a new flight, at last minute fares (usually a lot more expensive). Have a lot of buffer between the flights to account for any delays or cancellations, and have good travel insurance (and read the terms of the insurance policy!).
If the second flight is a cheap flight (even at the last minute), on a route with many alternatives, you can probably take the risk. If the second flight is an expensive flight with only a single flight a day on that route (or less), then the risk is much higher.
The other risk is if the second flight gets cancelled or you somehow get denied boarding. This can quickly turn ugly.
Self-connections are risky. Self-connections with a transit via a country you don't have the right to enter is very very very risky (if at all possible).