get obj unique id

i am making a driver function that is dependent on obj names but if the name is changed than it will brake the driver
is there some sort of unchanging unique id or something i can use to find the obj regardless of its name ? preferably something that means it dose not need to loop every obj to find it

other than that the only thing i can think of is to make a global var that stores the objs but that seems like it might make a mess as i cant think of any way to check for obsolete objs that are not needed any more

ok so i made an obj var and add the object data to it so each one has a unique id and just put that id in to the driver function
also empty places from removed objects can be cleared with a function if needed