BCL
Engineer
Immigration is concerned with the person’s admissibility into the country. Customs is concerned with the admissibility of the person’s belongings into the country (possibly subject to a certain tax).
AIrport security is concerned with making sure you don’t have things that are prohibited to carry onto an airplane. You could have a hunting knife, large bottle of liquid, etc., in your checked baggage and, as long as it doesn’t violate any customs regulations, you’re perfectly fine in their eyes. But you can’t bring those items past the security checkpoint.
The fact is that US CBP does all of the above. At least originally the US Customs Service was part of the Dept of Treasury and their primary purpose was the collection of customs duties. But like many things, they were in a convenient spot to look out for all sorts of things including border/port of entry controls, smuggling, agricultural checks, immigration, etc. The job itself didn't fit into any one category, but for whatever reason, they started with revenue collection.
They don't issue entry visas, which are the purview of the State Dept. They don't set the rules for agricultural inspection, but they have to know what people can and can't bring in. I have encountered USDA officers with sniffer dogs looking for contraband.
There are a few things though, including that any dangerous item might need to be declared - especially firearms.