Is it possible to move an object to a position (by using lerp or similar code for example) while avoiding another object (or objects in specific layers) that might be in the way?
If you want to avoid all objects, the simplest way is probably to just disable that object’s collider while its moving.
If you want to avoid objects on specific layers, see the collision matrix settings at:
Edit > Project Settings > Physics > Layer Collision Matrix
Or if this is a 2D project:
Edit > Project Settings > Physics 2D > Layer Collision Matrix
Use the matrix to define which layers can and cannot collide with which other layers.
Once that’s done, set the layers of the GameObjects you want to avoid to one layer value, then set the layer of the GameObject you want to move to one that the other objects cannot collide with.
@Vryken has told you how to prevent collisions entirely, but I’m going to assume you mean avoid in the sense of “intelligently move around the object instead of through it”. That’s referred to as pathfinding in gamedev, and the strategy you employ varies wildly depending on your game. Here’s a primer on Unity’s built in solution, known as a navmesh.
i am afraid he means something like boids.