What do $\ell$ and $A$ precisely mean in the formula for electrical resistance? The formula for resistance is
$$R=\rho\frac{\ell}{A}$$
Generally in most of the textbooks it simply written that $\ell$ is the length of the conductor and $A$ is it’s cross-sectional area. But my question is which length and area do we need to consider as a 3D body has many possible lengths and cross sectional areas. Textbooks simply take an example of a solid cuboid whose opposite faces are supplied with potential difference. But what if I change the faces across which potential difference is applied (for example if I choose two adjacent faces of same cuboid) or I change the shape of the conductor itself (for example a solid sphere whose two faces (across whom potential difference is applied) are opposite semi-hemispherical surfaces.
I’m a beginner in electromagnetism and needs a lot of new learning. So please help.
 A: The formula you showed is intended for a "long" wire. In this case the length and the cross section area are well-define. If you instead consider unusual configurations the formula for the resistance will (most probably) contain an integral. However, instead of considering the resistance one would calculate equi-potential surfaces: Use Maxwell's equation inside a conductor (with finite conductivity). These things get messy that's why numerical simulations are often used.
Taking your case where the wire is replaced by a sphere of radius $R$ and the connections are at radius $r<R$, the situation is simple enough to use the resistance.

In this case the "contribution" of the sphere is given by the integral
$$
R =  \int_{-r}^r\frac{\rho}{A(x)}\; dx
= 2 \int_0^r\frac{\rho}{A(x)}\; dx
$$
where the cross-section (indicated in blue) is given by $A(x) = \pi (R^2-x^2)$.
Why Maxwell's equations?
From the physics point of view Maxwell's equations are most fundamental to the subject of (classical) electro-dynamics. However, they do not contain a resistance. Instead they use electric and magnetic fields.
Why equip-potential surfaces? The solutions to Maxwell's equations for any setup are well-defined, if the boundary conditions are given. The standard boundary condition for your kind of problem is to define the electric potential on equi-potential surfaces. Probably there exists clever ways to simplify and automate the numerical calculation. So if you are primarily  interested in an "how to" manual, you should probably ask an electrical engineer.
A: In the formula the area(A) is perpendicular to the flow current,
The length (l) is along the flow of current.
Consider an example that will clear you doubt.
Consider a  hollow cylinder with inner radius 'a' and outer radius 'b'
and length 'l' .

Case 1-  Potential difference is applied along the length 'l' of cylinder.
Here current flows along the length (l) and area perpendicular to it is $$π (b^2-a^2)$$
$$R = \frac{pl}{π(b^2-a^2)}$$
Case 2- Potential is applied across the inner part and outer part of cylinder
Here the the current flows from inner part to outer part of cylinder.
The area perpendicular to current flow is different for different distance from the centre of cylinder. Therefore it will require integration.
Consider  a cylinder of  radius $\pmb x$ from the centre of hollow cylinder, its   AREA=$\pmb {2\pi xl}$( this is perpendicular to current flow)
Consider a width $\pmb {dx}$ along $\pmb x $, this will be along the flow of current hence this will be the length of small elemental part considered .
Now consider infinite such cylinders from $\pmb a \ to \ \pmb b$ each of length $\pmb {dx} $ .
All these cylinders will be in series.
Hence
$$R = \int_a^b dR = \int_a^b\frac{p dx }{2πxl} =\frac{p ln \frac ba}{2πl}$$
Hope it clears your doubt , try using this concept for finding resistance of a cuboid along different edge lengths .
As to your second question - it can be done similarly by considering that the potential difference is applied across diametrically opposite ends of sphere,
The area perpendicular to current can be taken  as circular plate having width $\pmb  {dr}$,
and then integrating along the diametric length. I leave it upto you to try the integration for this.
A: 
Textbooks simply take an example of a solid cuboid whose opposite faces are supplied with potential difference. But what if I change the faces across which potential difference is applied(for example if I choose two adjacent faces of same cuboid)

It depends all on the direction of current flow.
Let's take a cuboid with side lengths $\ell_x$, $\ell_y$, $\ell_z$ (in $x$, $y$ and $z$ direction).


*

*Now let's connect a voltage between the left and right faces of the cuboid, so that current flows in $x$-direction. Then the length is $\ell=\ell_x$ and the cross-section is $A=\ell_y\ell_z$. So the resistance becomes $R=\rho\frac{\ell}{A}=\rho\frac{\ell_x}{\ell_y\ell_z}$.

*As another example let's connect a voltage between the top and bottom faces of the cuboid, so that current flows in $z$-direction. Then the length is $\ell=\ell_z$ and the cross-section is $A=\ell_x\ell_y$. So the resistance becomes $R=\rho\frac{\ell}{A}=\rho\frac{\ell_z}{\ell_x\ell_y}$.

