This is exactly the type of thing interfaces are great for. You can define an unreal interface and have these various objects implement it, then have your function accept a pointer to the interface type.
Alternatively, you could accept type AActor (or UObject if parameter might not be a type of actor), then use casting to the expected types within the function to see what type you are dealing with, and use reflection to check for and get the property you are looking for.
An interface would be much cleaner and simpler though.