As you probably know, an array has values and each value has a key (['key1' => 'value1']), the value could also be another array. In your example, you have used an array (user.basket), each dot represents a new level of the array.
Remove by value
You push your ID to the session array. You don't specify any key and it will therefore get an unknown key, so you want to remove it using a value (your ID). The variable $valueToRemove in the example is your ID.
session()->put('user.basket', array_diff(session()->get('user.basket'), [$valueToRemove]));
To explain: Replace the user basket with everything in user basket that isn't in the array that only contains the $valueToRemove.
Remove by key
Lets say you know the which key (position) you want to remove, for example if you loop throw the array foreach(session()->get('user.basket') as $key => $value). Then you can remove the specific key using forget.
session()->forget('user.basket.'.$keyToRemove); // example: 'user.basket.7'
Your code
public function removeItem($id)
{
session()->put('user.basket', array_diff(session()->get('user.basket'), [$id]))
return back();
}