If your talking about self-propelled artillery such as typified by the M-109 they resemble tanks only in that they tend to be tracked (but not always) and mount the ordnance in a turret (but not always). Functionally they have nothing else in common due to the different roles.
Tanks are intended to fight in high-threat environments right up front with the ground-pounders. For this they need high mobility, a high degree of protection and considerable direct fire-power.
Self-propelled guns give artillery the mobility to keep up with armored forces (tanks and IFV/APC's) while providing some protection against small arms and artillery fragments to boot. Thus they don't need to be as fast as a tank, nor as heavily armored since (if things go right) they won't face direct fire from enemy anti-armor weapons.

A artillery cannon can place a lot of hurt on buildings, but that doesn't make them tanks. A "tank" is a armored (inevitably tracked) vehicle capable of cross-country maneuver to blast the crap out of enemy "hard points", in support of other units or for its own purposes. Some artillery probably aren't cross country (stuff like Caesar), can't maneuver (not sure if they can even fire on the move), and definitely can't take the hurt like a tank. They also lack the piles of machineguns that tanks have.
Though it's always possible to use artillery as DF weapons, it isn't recommended because that implies that the target is in range, where the survivability of the defending unit is the problem, not its firepower.

Tanks fire direct. They usually sight their target thru an optical or thermal imaging sight mounted on the tank. Tank range is usually less than 3500 meters (2.2 miles), although several M1A kills were recorded during the 1st Gulf War in excess of 4000 meters (2.5 miles).
Artillery fires indirect. Cannon crews hardly ever see their targets. A forward observer, or another unit, detects the target, and calls in artillery fire upon it. Cannon range for un-assisted shells is typically 7 miles, and 20 miles for rocket-assisted shells.
Texastillidie

"Cannon range for un-assisted shells is typically 7 miles, and 20 miles for rocket-assisted shells."
= approx 11km and 32km. Depends what 'typical means'. The majority of western armies have guns with a max range of more than 11km, even at 105 mm the norm is now about 15 km. Very few armies waste their money on RAP, most use base bleed because it's better. If you run a 155mm 52 cal barrel then think closer to 40 km.

Some artillery have secondary direct fire ability. SPHs like the AS90 and the PzH2000 have direct fire sights built in, as do some towed artillery.
I'm not sure whether Western 155mm systems have anti-tank rounds, but HE hit from one of these guns in direct fire mode may acheive a 'shock kill' on a modern MBT. I know that the 22kg HE rounds from the old Russian 152mm gun could blow turrets off a Panther tank.
Speaking of Russians - Russian artillery placed greater emphasis on direct fire than Western armies do. The D30 122mm towed gun (plenty of which are still in use), for example, has a secondary role as an anti-tank gun. Once mounted, it can rotate 360 degrees on its pedestal and it was always issued with a few HEAT rounds.

Direct fire anti-tank is definetely best avoided, particualrly today when tank fire control arrangements are extremely effective. Its prpably true that since after WW1 most light field guns (say up to 122mm) have had direct fire sights, and the modern ones have night sights as well.
In WW2 Stalin directed that all field guns were anti-tank guns and they were used to add depth to the anti-tank defence. This notion seems to linger on.
IIRC the 122mm anti-tank shell (the one used by the Egyptian artillery in 1973) is not ordinary HEAT, it's a bit more complicated than that.

I have seen that French have developped an APFSDS for 155 mm but I don't know if it is fielded today.The firecontrol of 155 mm AUF1/2 allow computerized precise direct hit but it is a secondary mode and can not be use on the move.
Best way is anti tank dual smart bomblet Bonus shell .A AUF2 will fire 20 smart IR guided top attack bomblets in a minute.Pretty effective.French has ordered 4500 shell in the last years.Digital networking and C4ISR like Orchidée long range radar helicopter ( 2000 ground target real time tracking at 200 km) could allow 2 artillery regiment (48 AUF1/2) to destroy an armored division in minutes.